Updated
Browse files
src/embedding/embedding.py
CHANGED
@@ -13,12 +13,14 @@ from langchain_huggingface import HuggingFaceEmbeddings
|
|
13 |
# return embedding_instance
|
14 |
|
15 |
|
16 |
-
from
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
model_kwargs={"device": "cpu"},
|
21 |
-
)
|
22 |
|
23 |
def all_minilm_l6_v2():
|
24 |
"""
|
|
|
13 |
# return embedding_instance
|
14 |
|
15 |
|
16 |
+
from sentence_transformers import SentenceTransformer
|
17 |
+
from langchain.embeddings import HuggingFaceEmbeddings
|
18 |
+
|
19 |
+
# Load the sentence-transformers model directly
|
20 |
+
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
21 |
|
22 |
+
# Wrap it in LangChain HuggingFaceEmbeddings by passing the model instance
|
23 |
+
embedding_instance = HuggingFaceEmbeddings(model=model)
|
|
|
|
|
24 |
|
25 |
def all_minilm_l6_v2():
|
26 |
"""
|