NielsRogge/Transformers-Tutorials

"Unused or unrecognized kwargs: padding" error when running notebook example

jferments opened this issue · 0 comments

When I run the code from the example notebook Zero_shot_image_segmentation_with_CLIPSeg.ipynb:

from PIL import Image
import requests
from transformers import CLIPSegProcessor, CLIPSegForImageSegmentation

url = "https://github.com/timojl/clipseg/blob/master/example_image.jpg?raw=true"
image = Image.open(requests.get(url, stream=True).raw)

processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")

prompts = ["a glass", "something to fill", "wood", "a jar"]

inputs = processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")

The sample image and model loads fine, but then I get the following error when calling processor():

Unused or unrecognized kwargs: padding.