-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Description
Hi guys,
For the fun of it, I tried to load a SentenceTransformers on the google/t5gemma-2-270m-270m configs and weights with this line: st_pytorch_model = SentenceTransformer(input_model_root_path, backend="torch", device="xpu", trust_remote_code=True, local_files_only=True, model_kwargs={"dtype": torch.float32}).eval(). I'm getting this trace:
Loading pytorch model: /media/user/500gb1/models/huggingface/google/t5gemma-2-270m-270m
No sentence-transformers model found with name /media/user/500gb1/models/huggingface/google/t5gemma-2-270m-270m. Creating a new one with mean pooling.
Loading weights: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 911/911 [00:13<00:00, 66.90it/s, Materializing param=encoder.vision_tower.vision_model.post_layernorm.weight]
Traceback (most recent call last):
File "/home/user/Documents/ir-sts/./t5gemma2.py", line 17, in <module>
st_pytorch_model = SentenceTransformer(input_model_root_path, backend="torch", device="xpu", trust_remote_code=True, local_files_only=True, model_kwargs={"dtype": torch.float32}).eval()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/venv/optimum-onnx-git/lib/python3.12/site-packages/sentence_transformers/SentenceTransformer.py", line 339, in __init__
modules = self._load_auto_model(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/venv/optimum-onnx-git/lib/python3.12/site-packages/sentence_transformers/SentenceTransformer.py", line 2120, in _load_auto_model
pooling_model = Pooling(transformer_model.get_word_embedding_dimension(), "mean")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/venv/optimum-onnx-git/lib/python3.12/site-packages/sentence_transformers/models/Transformer.py", line 288, in get_word_embedding_dimension
return self.auto_model.config.hidden_size
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/venv/optimum-onnx-git/lib/python3.12/site-packages/transformers/configuration_utils.py", line 200, in __getattribute__
return super().__getattribute__(key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'T5Gemma2Config' object has no attribute 'hidden_size'
I don't know if it's a good idea in general (I don't even know what they mean by tied embedding, but is there a quick hack to fix the 'T5Gemma2Config' object has no attribute 'hidden_size' error and be able to try the model as a sentence embedder? Thanks!
Metadata
Metadata
Assignees
Labels
No labels