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'
Code
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'