提交 0706a290 作者: imClumsyPanda

update embedding define in local_doc_qa.py and langchain version in requirements.txt

上级 54c983f4
...@@ -33,6 +33,7 @@ def load_file(filepath): ...@@ -33,6 +33,7 @@ def load_file(filepath):
class LocalDocQA: class LocalDocQA:
llm: object = None llm: object = None
embeddings: object = None embeddings: object = None
top_k: int = VECTOR_SEARCH_TOP_K
def init_cfg(self, def init_cfg(self,
embedding_model: str = EMBEDDING_MODEL, embedding_model: str = EMBEDDING_MODEL,
...@@ -49,9 +50,10 @@ class LocalDocQA: ...@@ -49,9 +50,10 @@ class LocalDocQA:
use_ptuning_v2=use_ptuning_v2) use_ptuning_v2=use_ptuning_v2)
self.llm.history_len = llm_history_len self.llm.history_len = llm_history_len
self.embeddings = HuggingFaceEmbeddings(model_name=embedding_model_dict[embedding_model], ) self.embeddings = HuggingFaceEmbeddings(model_name=embedding_model_dict[embedding_model],
self.embeddings.client = sentence_transformers.SentenceTransformer(self.embeddings.model_name, model_kwargs={'device': embedding_device})
device=embedding_device) # self.embeddings.client = sentence_transformers.SentenceTransformer(self.embeddings.model_name,
# device=embedding_device)
self.top_k = top_k self.top_k = top_k
def init_knowledge_vector_store(self, def init_knowledge_vector_store(self,
......
langchain>=0.0.124 langchain>=0.0.146
transformers==4.27.1 transformers==4.27.1
unstructured[local-inference] unstructured[local-inference]
layoutparser[layoutmodels,tesseract] layoutparser[layoutmodels,tesseract]
...@@ -9,4 +9,4 @@ icetk ...@@ -9,4 +9,4 @@ icetk
cpm_kernels cpm_kernels
faiss-cpu faiss-cpu
gradio>=3.25.0 gradio>=3.25.0
detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.6#egg=detectron2 #detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.6#egg=detectron2
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论