captain-awesome
commited on
Commit
•
a00e62a
1
Parent(s):
4c2398a
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@
|
|
13 |
# from chromadb.utils import embedding_functions
|
14 |
# from langchain.embeddings import SentenceTransformerEmbeddings
|
15 |
# from langchain.embeddings import HuggingFaceBgeEmbeddings
|
|
|
16 |
from langchain.document_loaders import (
|
17 |
CSVLoader,
|
18 |
DirectoryLoader,
|
@@ -354,14 +355,19 @@ def main():
|
|
354 |
)
|
355 |
st.write("LLM Initialized:")
|
356 |
|
357 |
-
model_name = "BAAI/bge-large-en"
|
358 |
-
model_kwargs = {'device': 'cpu'}
|
359 |
-
encode_kwargs = {'normalize_embeddings': False}
|
360 |
-
embeddings = HuggingFaceBgeEmbeddings(
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
)
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
# llm = load_model()
|
367 |
# prompt = set_custom_prompt()
|
|
|
13 |
# from chromadb.utils import embedding_functions
|
14 |
# from langchain.embeddings import SentenceTransformerEmbeddings
|
15 |
# from langchain.embeddings import HuggingFaceBgeEmbeddings
|
16 |
+
from langchain.embeddings import HuggingFaceInstructEmbeddings
|
17 |
from langchain.document_loaders import (
|
18 |
CSVLoader,
|
19 |
DirectoryLoader,
|
|
|
355 |
)
|
356 |
st.write("LLM Initialized:")
|
357 |
|
358 |
+
# model_name = "BAAI/bge-large-en"
|
359 |
+
# model_kwargs = {'device': 'cpu'}
|
360 |
+
# encode_kwargs = {'normalize_embeddings': False}
|
361 |
+
# embeddings = HuggingFaceBgeEmbeddings(
|
362 |
+
# model_name=model_name,
|
363 |
+
# model_kwargs=model_kwargs,
|
364 |
+
# encode_kwargs=encode_kwargs
|
365 |
+
# )
|
366 |
+
|
367 |
+
embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl",
|
368 |
+
model_kwargs={"device": "cpu"})
|
369 |
+
|
370 |
+
|
371 |
|
372 |
# llm = load_model()
|
373 |
# prompt = set_custom_prompt()
|