Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ChineseCLIPConfig' object has no attribute 'hidden_size' #347

Open
Manjiz opened this issue Aug 20, 2024 · 0 comments
Open

Comments

@Manjiz
Copy link

Manjiz commented Aug 20, 2024

不确定是否应该提 issue 到这里,在 transformers 里的代码执行的时候抛了这个错:

AttributeError: 'ChineseCLIPConfig' object has no attribute 'hidden_size'

不知道是不是因为模型不支持 sentence_transformers。

完整错误如下:

Traceback (most recent call last):
  File "/usr/local/python3/bin/eland_import_hub_model", line 8, in <module>
    sys.exit(main())
  File "/usr/local/python3/lib/python3.8/site-packages/eland/cli/eland_import_hub_model.py", line 279, in main
    tm = TransformerModel(
  File "/usr/local/python3/lib/python3.8/site-packages/eland/ml/pytorch/transformers.py", line 665, in __init__
    self._traceable_model = self._create_traceable_model()
  File "/usr/local/python3/lib/python3.8/site-packages/eland/ml/pytorch/transformers.py", line 1000, in _create_traceable_model
    model = _SentenceTransformerWrapperModule.from_pretrained(
  File "/usr/local/python3/lib/python3.8/site-packages/eland/ml/pytorch/transformers.py", line 325, in from_pretrained
    return _SentenceTransformerWrapper(model, output_key)
  File "/usr/local/python3/lib/python3.8/site-packages/eland/ml/pytorch/transformers.py", line 352, in __init__
    super().__init__(model=model, output_key=output_key)
  File "/usr/local/python3/lib/python3.8/site-packages/eland/ml/pytorch/transformers.py", line 298, in __init__
    self._st_model = SentenceTransformer(model.config.name_or_path)
  File "/usr/local/python3/lib/python3.8/site-packages/sentence_transformers/SentenceTransformer.py", line 202, in __init__
    modules = self._load_auto_model(
  File "/usr/local/python3/lib/python3.8/site-packages/sentence_transformers/SentenceTransformer.py", line 973, in _load_auto_model
    pooling_model = Pooling(transformer_model.get_word_embedding_dimension(), "mean")
  File "/usr/local/python3/lib/python3.8/site-packages/sentence_transformers/models/Transformer.py", line 114, in get_word_embedding_dimension
    return self.auto_model.config.hidden_size
  File "/usr/local/python3/lib/python3.8/site-packages/transformers/configuration_utils.py", line 262, in __getattribute__
    return super().__getattribute__(key)
AttributeError: 'ChineseCLIPConfig' object has no attribute 'hidden_size'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant