Tuchuanhuhuhu commited on
Commit
45b6bd1
1 Parent(s): 84fa55b

改善非英语文本的local embedding效果

Browse files
Files changed (2) hide show
  1. modules/base_model.py +1 -1
  2. modules/llama_func.py +1 -1
modules/base_model.py CHANGED
@@ -201,7 +201,7 @@ class BaseLLMModel:
201
  msg = "索引获取成功,生成回答中……"
202
  logging.info(msg)
203
  if local_embedding or self.model_type != ModelType.OpenAI:
204
- embed_model = LangchainEmbedding(HuggingFaceEmbeddings())
205
  else:
206
  embed_model = OpenAIEmbedding()
207
  # yield chatbot + [(inputs, "")], msg
 
201
  msg = "索引获取成功,生成回答中……"
202
  logging.info(msg)
203
  if local_embedding or self.model_type != ModelType.OpenAI:
204
+ embed_model = LangchainEmbedding(HuggingFaceEmbeddings(model_name = "sentence-transformers/distiluse-base-multilingual-cased-v2"))
205
  else:
206
  embed_model = OpenAIEmbedding()
207
  # yield chatbot + [(inputs, "")], msg
modules/llama_func.py CHANGED
@@ -134,7 +134,7 @@ def construct_index(
134
  try:
135
  documents = get_documents(file_src)
136
  if local_embedding:
137
- embed_model = LangchainEmbedding(HuggingFaceEmbeddings())
138
  else:
139
  embed_model = OpenAIEmbedding()
140
  logging.info("构建索引中……")
 
134
  try:
135
  documents = get_documents(file_src)
136
  if local_embedding:
137
+ embed_model = LangchainEmbedding(HuggingFaceEmbeddings(model_name = "sentence-transformers/distiluse-base-multilingual-cased-v2"))
138
  else:
139
  embed_model = OpenAIEmbedding()
140
  logging.info("构建索引中……")