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

#18
by michaelfeil - opened

File "/mnt/cache/zhangxingyan/env/emb/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 298, in init
modules = self._load_auto_model(
File "/mnt/cache/zhangxingyan/env/emb/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 1319, in _load_auto_model
pooling_model = Pooling(transformer_model.get_word_embedding_dimension(), "mean")
File "/mnt/cache/zhangxingyan/env/emb/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 133, in get_word_embedding_dimension
return self.auto_model.config.hidden_size
File "/mnt/cache/zhangxingyan/env/emb/lib/python3.10/site-packages/transformers/configuration_utils.py", line 264, in getattribute
return super().getattribute(key)
AttributeError: 'NVEmbedConfig' object has no attribute 'hidden_size'

ERROR: Application startup failed. Exiting.

NVIDIA org

Thanks for reporting the issue. Currently, sentence transformer is not supported, but we will try to add the sentence transformer compatibility soon.

NVIDIA org

Now, NV-Embed-v1 supports the compatibility for sentence transformer. The example is updated in model card: https://huggingface.co/nvidia/NV-Embed-v1. Thank you.

michaelfeil changed discussion status to closed

File "/home/tlv/duplicate-content-checker/tests/models_test/evaluation.py", line 40, in
evaluation(
File "/home/tlv/duplicate-content-checker/tests/models_test/evaluation.py", line 20, in evaluation
model = SentenceTransformer(model_name, trust_remote_code=True, device=device)
File "/home/tlv/duplicate-content-checker/venv/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 205, in init
modules = self._load_auto_model(
File "/home/tlv/duplicate-content-checker/venv/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 1203, in _load_auto_model
pooling_model = Pooling(transformer_model.get_word_embedding_dimension(), "mean")
File "/home/tlv/duplicate-content-checker/venv/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 114, in get_word_embedding_dimension
return self.auto_model.config.hidden_size
File "/home/tlv/duplicate-content-checker/venv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 263, in getattribute
return super().getattribute(key)
AttributeError: 'NVEmbedConfig' object has no attribute 'hidden_size'
Hello, I still have this issue. My SentenceTransformers is v3.0.1 now.

Sign up or log in to comment