Spaces:
Sleeping
Sleeping
SentenceTransformers as separate instance
Browse files- README.md +0 -1
- requirements.txt +0 -1
- worker.py +5 -2
README.md
CHANGED
@@ -9,7 +9,6 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
short_description: Chatbot assistant for the CAMELS simulations documentation
|
12 |
-
python_version: 3.11
|
13 |
---
|
14 |
|
15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
short_description: Chatbot assistant for the CAMELS simulations documentation
|
|
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
requirements.txt
CHANGED
@@ -2,4 +2,3 @@ langchain
|
|
2 |
langchain-community
|
3 |
langchain-huggingface
|
4 |
chromadb
|
5 |
-
InstructorEmbedding
|
|
|
2 |
langchain-community
|
3 |
langchain-huggingface
|
4 |
chromadb
|
|
worker.py
CHANGED
@@ -5,7 +5,7 @@ from langchain_community.document_loaders import PyPDFLoader
|
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
from langchain_community.vectorstores import Chroma
|
7 |
from langchain_huggingface import HuggingFaceEndpoint
|
8 |
-
|
9 |
import pip
|
10 |
|
11 |
def install(package):
|
@@ -49,8 +49,11 @@ def init_llm():
|
|
49 |
#Initialize embeddings using a pre-trained model to represent the text data.
|
50 |
embedddings_model = "sentence-transformers/multi-qa-distilbert-cos-v1"
|
51 |
# embedddings_model = "sentence-transformers/all-MiniLM-L6-v2"
|
|
|
|
|
|
|
52 |
embeddings = HuggingFaceInstructEmbeddings(
|
53 |
-
model_name=
|
54 |
model_kwargs={"device": DEVICE}
|
55 |
)
|
56 |
|
|
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
from langchain_community.vectorstores import Chroma
|
7 |
from langchain_huggingface import HuggingFaceEndpoint
|
8 |
+
from sentence_transformers import SentenceTransformer # Use SentenceTransformer module to use Hugging face Model
|
9 |
import pip
|
10 |
|
11 |
def install(package):
|
|
|
49 |
#Initialize embeddings using a pre-trained model to represent the text data.
|
50 |
embedddings_model = "sentence-transformers/multi-qa-distilbert-cos-v1"
|
51 |
# embedddings_model = "sentence-transformers/all-MiniLM-L6-v2"
|
52 |
+
|
53 |
+
emb_model = SentenceTransformer(embedddings_model)
|
54 |
+
|
55 |
embeddings = HuggingFaceInstructEmbeddings(
|
56 |
+
model_name=emb_model,
|
57 |
model_kwargs={"device": DEVICE}
|
58 |
)
|
59 |
|