NomicBertModel.forward() got an unexpected keyword argument 'return_dict'
#10
by
edsealing
- opened
Using SentenceTransformer to load the model:
model_name = 'nomic-ai/nomic-embed-text-v1'
embedmodel = SentenceTransformer(model_name, trust_remote_code=True)
return setup_model_device(embedmodel, model_name)
When attempting to call the embedding function, I receive an error.
def compute(self, docs: list[str]) -> list[Optional[Item]]:
"""Call the embedding function."""
prefixed_docs = [f"search_document {doc}" for doc in docs]
return chunked_compute_embedding(
self._model.encode, prefixed_docs, self.local_batch_size * 16, chunker=clustering_spacy_chunker
)
NomicBertModel.forward() got an unexpected keyword argument 'return_dict'
thanks for the headsup!
Just fixed and tested
from sentence_transformers import SentenceTransformer
model_name = 'nomic-ai/nomic-embed-text-v1'
embedmodel = SentenceTransformer(model_name, trust_remote_code=True)
test = ["search_query: who does shohei ohtani play for?", "search_document: shohei ohtani plays for the los angeles dodgers"]
embedmodel.encode(test)
Let me know if it doesn't work on your end
That did the trick! Fastest fix I think I've ever seen...
Cheers!
edsealing
changed discussion status to
closed