UKPLab / sentence-transformers

State-of-the-Art Text Embeddings
https://www.sbert.net
Apache License 2.0
14.98k stars 2.44k forks source link

Error while loading model #2811

Open abhigrazitti opened 3 months ago

abhigrazitti commented 3 months ago

Code

from sentence_transformers import SentenceTransformer
model = SentenceTransformer('thenlper/gte-large')
sentences = ["This is an example sentence", "Each sentence is converted"]
embeddings = model.encode(sentences)
print(embeddings.shape)

Version Python version: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] PyTorch version: 2.2.1+cpu

Error RuntimeError: Failed to import transformers.models.bert.modeling_bert because of the following error (look up to see its traceback): Failed to import transformers.integrations.peft because of the following error (look up to see its traceback): cannot import name '_data_ptr_allocated' from 'torch.distributed.utils'

tomaarsen commented 3 months ago

Hello!

It looks like your transformers and torch versions are conflicting. I suspect that you can resolve this by either:

  1. downgrading transformers
  2. upgrading torch