-
Notifications
You must be signed in to change notification settings - Fork 548
Description
ChineseCLIPTextModel 默认值为 False (https://github.com/huggingface/transformers/blob/main/src/transformers/models/chinese_clip/modeling_chinese_clip.py Line 993) self.text_model = ChineseCLIPTextModel(text_config, add_pooling_layer=False)
在运行https://huggingface.co/OFA-Sys/chinese-clip-vit-huge-patch14中的代码text_features = model.get_text_features(**inputs)会报错:
File "/home/xxx/binxiao/TZTS/Filters/CN_CLIP.py", line 72, in
text_features = model.get_text_features(**inputs)
File "/home/xxx/miniconda3/envs/pt26/lib/python3.10/site-packages/transformers/utils/generic.py", line 809, in wrapper
return func(*args, **valid_kwargs)
File "/home/xxx/miniconda3/envs/pt26/lib/python3.10/site-packages/transformers/models/chinese_clip/modeling_chinese_clip.py", line 1075, in get_text_features
text_features = self.text_projection(pooled_output)
File "/home/xxx/miniconda3/envs/pt26/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/xxx/miniconda3/envs/pt26/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
File "/home/xxx/miniconda3/envs/pt26/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 125, in forward
return F.linear(input, self.weight, self.bias)
TypeError: linear(): argument 'input' (position 1) must be Tensor, not NoneType
因为get_text_features需要 pooler_output, 这里设置为False就会导致pooler_output为None. 请问这个是意外还是有意为之?