Provided example code is not working

#1
by Kkordik - opened

Hello, I am trying to run the code from Model card, but getting an error:

TypeError                                Traceback (most recent call last)

<ipython-input-1-fd909bbb6593> in <cell line: 11>()
      9 
     10 processor = DPTImageProcessor.from_pretrained("Intel/dpt-swinv2-tiny-256")
---> 11 model = DPTForDepthEstimation.from_pretrained("Intel/dpt-swinv2-tiny-256")
     12 
     13 # prepare image for the model

4 frames

/usr/local/lib/python3.10/dist-packages/transformers/models/dpt/modeling_dpt.py in __init__(self, config)
    288         image_size = image_size if isinstance(image_size, collections.abc.Iterable) else (image_size, image_size)
    289         patch_size = patch_size if isinstance(patch_size, collections.abc.Iterable) else (patch_size, patch_size)
--> 290         num_patches = (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])
    291         self.image_size = image_size
    292         self.patch_size = patch_size

TypeError: unsupported operand type(s) for //: 'NoneType' and 'NoneType'

Here is colab notebook, that I am running: https://colab.research.google.com/drive/1fQ0nLVAu_30mp4ISQMjx7cuA-GAOWYFV?usp=sharing

Please help, Thanks.

Hi,

It looks like you need to update your Transformers version.

Sign up or log in to comment