CLIP-Chinese
CLIP-Chinese copied to clipboard
TypeError: unsupported operand type(s) for *: 'dict' and 'int'
I am a beginner in natural language processing.
When I clone the repository, install the environment dependencies, and try to run the quickstart code in README, the following error occurs, how should I solve it?
my python version is 3.8.15, other dependencies have the same version as the requirements.txt
Traceback (most recent call last):
File "quickstart.py", line 15, in <module>
inputs = processor(text=["一只小狗在摇尾巴", "一只小猪在吃饭"], images=image, return_tensors="pt", padding=True)
File "/home/liuzhiming/.miniconda3/envs/clip-chinese/lib/python3.8/site-packages/transformers/models/clip/processing_clip.py", line 85, in __call__
image_features = self.feature_extractor(images, return_tensors=return_tensors, **kwargs)
File "/home/liuzhiming/.miniconda3/envs/clip-chinese/lib/python3.8/site-packages/transformers/models/clip/feature_extraction_clip.py", line 146, in __call__
images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
File "/home/liuzhiming/.miniconda3/envs/clip-chinese/lib/python3.8/site-packages/transformers/models/clip/feature_extraction_clip.py", line 146, in <listcomp>
images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
File "/home/liuzhiming/.miniconda3/envs/clip-chinese/lib/python3.8/site-packages/transformers/models/clip/feature_extraction_clip.py", line 207, in resize
new_short, new_long = size, int(size * long / short)
TypeError: unsupported operand type(s) for *: 'dict' and 'int'
I tried to output the values of several parameters in transformers/models/clip/feature_extraction_clip.py", line 207, in resize
and found that the type of size
is dict
, not int
,The specific values are as follows:
size: {'shortest_edge': 224}
long=960
short=600
I have the same question, then I use the Transformers-4.25.1 and the question is solved. Hope help you~
I have the same question, then I use the Transformers-4.25.1 and the question is solved. Hope help you~
Thanks, when I updated the version of transformers
from 4.18.0
to 4.25.1
, the error problem was solved.
TypeError: unsupported operand type(s) for *: 'dict' and 'int'
same question
I have the same question, then I use the Transformers-4.25.1 and the question is solved. Hope help you~
Thanks, when I updated the version of
transformers
from4.18.0
to4.25.1
, the error problem was solved.
hello, I met the problem like "texts.append(data['text']) KeyError: 'text'" when I updated the version to 4.25.1, and I would like to ask if you encountered the same problem and how to solve it.
I have the same question, then I use the Transformers-4.25.1 and the question is solved. Hope help you~
Thanks, when I updated the version of
transformers
from4.18.0
to4.25.1
, the error problem was solved.hello, I met the problem like "texts.append(data['text']) KeyError: 'text'" when I updated the version to 4.25.1, and I would like to ask if you encountered the same problem and how to solve it.
same question!!!