RCaz commited on
Commit
ccbc197
·
1 Parent(s): b04ba1d

fixed embeddings loading

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -36,8 +36,17 @@ def load_from_azure(container_name, local_dir="./index"):
36
  load_from_azure("blobcontaineravatarbot")
37
 
38
  # Load into FAISS
39
- embeddings="intfloat/e5-base-v2"
40
- vectorstore = FAISS.load_local("./index", embeddings, allow_dangerous_deserialization=True)
 
 
 
 
 
 
 
 
 
41
 
42
  # Include a rate limiter
43
  from collections import defaultdict
 
36
  load_from_azure("blobcontaineravatarbot")
37
 
38
  # Load into FAISS
39
+ from langchain_community.embeddings import HuggingFaceEmbeddings # deprecated
40
+ # from langchain_huggingface import HuggingFaceEmbeddings
41
+
42
+ embedding_model = HuggingFaceEmbeddings(
43
+ model_name="intfloat/e5-base-v2",
44
+ # multi_process=True,
45
+ model_kwargs={"device": "mps"}, # use cuda for faster embeddings on nbidia GPUs
46
+ encode_kwargs={"normalize_embeddings": True}, # Set `True` for cosine similarity
47
+ )
48
+
49
+ vectorstore = FAISS.load_local("./index", embedding_model, allow_dangerous_deserialization=True)
50
 
51
  # Include a rate limiter
52
  from collections import defaultdict