You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having issues with accessing hugging face embeddings on dominol lab,I tried various code but nothing seems to work .sentence-transformers/all-MiniLM-L6-v2
Hello
Kindly Asking for help!!!!!!!
ALL DATASE ON DOMINOLAB
the following are the embeddings method I tried to access the local model.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm having issues with accessing hugging face embeddings on dominol lab,I tried various code but nothing seems to work .sentence-transformers/all-MiniLM-L6-v2
Hello
Kindly Asking for help!!!!!!!
ALL DATASE ON DOMINOLAB
the following are the embeddings method I tried to access the local model.
METHOD1:
def custom_embedding_function(texts):
with torch.no_grad():
encoded_input = tokenizer(texts, return_tensors='pt', padding=True, truncation=True)
outputs = model(**encoded_input)
token_embeddings = outputs.last_hidden_state
sentence_embeddings = token_embeddings.mean(dim=1)
return sentence_embeddings.numpy()
db = Chroma.from_documents(texts, custom_embedding_function)
ERROR:'Function' object has no attribute embed_documents
METHOD2:
class CustomEmbeddingFunction:
def init(self, tokenizer, model):
self.tokenizer = tokenizer
self.model = model
custom_embedding = CustomEmbeddingFunction(tokenizer, model)
db = Chroma.from_documents(texts, custom_embedding)
ERROR : custom_embedding object has no attribute embed_documents still get the same error
error is related to the LangChain library expecting an embed_documents attribute in the embedding function.
METHOD3:
from langchain.embeddings import HuggingFaceEmbeddings
model_name = "sentence-transformers/all-mpnet-base-v2"
model_kwargs = {'device': 'cpu'}
hf = HuggingFaceEmbeddings(model_name=model_name, model_kwargs=model_kwargs)
ERROR:
this one is callling huggingface Hub which i cant access
METHOD4:
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-MiniLM-L6-v2")
model = AutoModelForCausalLM.from_pretrained("sentence-transformers/all-MiniLM-L6-v2")
ERROR:
Testing if the embbedings model is working
Beta Was this translation helpful? Give feedback.
All reactions