TypeError: natten2dqkrpb() missing 1 required positional argument: 'dilation'

#1
by lucascassiano - opened

I got the following error

TypeError: natten2dqkrpb() missing 1 required positional argument: 'dilation'

This is how I installed Natten:

pipenv run pip install natten -f https://shi-labs.com/natten/wheels/cu118/torch2.0.0/index.html

And here is the code I'm running:

from transformers import OneFormerProcessor, OneFormerForUniversalSegmentation
from PIL import Image
import requests
url = "https://huggingface.co/datasets/shi-labs/oneformer_demo/resolve/main/coco.jpeg"
image = Image.open(requests.get(url, stream=True).raw)

# Loading a single model for all three tasks
processor = OneFormerProcessor.from_pretrained(
    "shi-labs/oneformer_coco_dinat_large")
model = OneFormerForUniversalSegmentation.from_pretrained(
    "shi-labs/oneformer_coco_dinat_large")

# Semantic Segmentation
semantic_inputs = processor(images=image, task_inputs=[
                            "semantic"], return_tensors="pt")
semantic_outputs = model(**semantic_inputs)

Any ideas on how to fix this issue?
many thanks!

open file ~/path_to_python/site-packages/transformers/models/dinat/modeling_dinat.py
goto "def forward", around line 350 you will find "attention_scores = natten2dqkrpb"
change to: "attention_scores = natten2dqkrpb(query_layer, key_layer, self.rpb, dilation=self.dilation, kernel_size=self.kernel_size)"

Sign up or log in to comment