Closed
Description
When I run the following code, I get an error "RuntimeError: linalg.vector_norm: Expected a floating point or complex tensor as input. Got Char" I do not understand how this can be, since the output is a number, and not a char...
from sentence_transformers import SentenceTransformer
from datasets import Dataset
import json, os, torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = SentenceTransformer('multi-qa-mpnet-base-cos-v1')
print('start encoding')
sentences = [
"The weather is so nice!",
"It's so sunny outside.",
"He's driving to the movie theater.",
"She's going to the cinema.",
]
embeddings = model.encode(sentences, show_progress_bar=True,
precision='int8')
print(embeddings)
print(type(embeddings))
print(model.similarity(embeddings, embeddings))
Metadata
Metadata
Assignees
Labels
No labels