Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ load_index_from_storage,
|
|
17 |
set_global_service_context,
|
18 |
)
|
19 |
#from langchain.embeddings import HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings
|
20 |
-
|
21 |
#from llama_index.embeddings.huggingface import HuggingFaceInstructEmbeddings
|
22 |
from g4f import Provider, models
|
23 |
|
@@ -25,7 +25,9 @@ from langchain.llms.base import LLM
|
|
25 |
from llama_index.llms.langchain import LangChainLLM
|
26 |
from langchain_g4f import G4FLLM
|
27 |
#from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
28 |
-
from llama_index.embeddings.huggingface import HuggingFaceInstructEmbeddings
|
|
|
|
|
29 |
from llama_index.core import Settings
|
30 |
nest_asyncio.apply()
|
31 |
g4f.debug.logging = True # Enable logging
|
@@ -47,7 +49,7 @@ embed_model = HuggingFaceInstructEmbeddings(
|
|
47 |
model_name = "hkunlp/instructor-xl"
|
48 |
model_kwargs = {'device': 'cpu'}
|
49 |
encode_kwargs = {'normalize_embeddings': True}
|
50 |
-
|
51 |
model_name=model_name,
|
52 |
model_kwargs=model_kwargs,
|
53 |
encode_kwargs=encode_kwargs
|
|
|
17 |
set_global_service_context,
|
18 |
)
|
19 |
#from langchain.embeddings import HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings
|
20 |
+
from langchain_community.embeddings import HuggingFaceInstructEmbeddings
|
21 |
#from llama_index.embeddings.huggingface import HuggingFaceInstructEmbeddings
|
22 |
from g4f import Provider, models
|
23 |
|
|
|
25 |
from llama_index.llms.langchain import LangChainLLM
|
26 |
from langchain_g4f import G4FLLM
|
27 |
#from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
28 |
+
#from llama_index.embeddings.huggingface import HuggingFaceInstructEmbeddings
|
29 |
+
from llama_index.embeddings.instructor import InstructorEmbedding
|
30 |
+
|
31 |
from llama_index.core import Settings
|
32 |
nest_asyncio.apply()
|
33 |
g4f.debug.logging = True # Enable logging
|
|
|
49 |
model_name = "hkunlp/instructor-xl"
|
50 |
model_kwargs = {'device': 'cpu'}
|
51 |
encode_kwargs = {'normalize_embeddings': True}
|
52 |
+
embed_model = HuggingFaceInstructEmbeddings(
|
53 |
model_name=model_name,
|
54 |
model_kwargs=model_kwargs,
|
55 |
encode_kwargs=encode_kwargs
|