ljy5946 commited on
Commit
a7b5cc2
·
verified ·
1 Parent(s): b7a5a02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -6,7 +6,7 @@ import logging
6
  # LangChain 0.1.x 系列的导入方式
7
  from langchain_chroma import Chroma
8
  from langchain.embeddings import HuggingFaceEmbeddings
9
- from langchain_community.llms import HuggingFacePipeline # <--- 这次主要修改在这里!
10
  from langchain.chains import RetrievalQA
11
 
12
  # Transformers 库
@@ -15,9 +15,10 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
15
  logging.basicConfig(level=logging.INFO)
16
 
17
  # 设置路径
18
- VECTOR_STORE_DIR = "./vector_store"
19
- MODEL_NAME = "./hf_models_cache/models--uer--gpt2-chinese-cluecorpussmall"
20
- EMBEDDING_MODEL_NAME = "./hf_models_cache/models--sentence-transformers--paraphrase-multilingual-mpnet-base-v2"
 
21
 
22
  # 1. 轻量 LLM(uer/gpt2-chinese-cluecorpussmall)
23
  print("🔧 加载生成模型...")
 
6
  # LangChain 0.1.x 系列的导入方式
7
  from langchain_chroma import Chroma
8
  from langchain.embeddings import HuggingFaceEmbeddings
9
+ from langchain_community.llms import HuggingFacePipeline
10
  from langchain.chains import RetrievalQA
11
 
12
  # Transformers 库
 
15
  logging.basicConfig(level=logging.INFO)
16
 
17
  # 设置路径
18
+ # 直接使用 Hugging Face Hub 上的模型 ID,而不是本地缓存路径
19
+ VECTOR_STORE_DIR = "./vector_store" # 这个目录用于 ChromaDB,我们保留
20
+ MODEL_NAME = "uer/gpt2-chinese-cluecorpussmall" # <--- 修改这里!
21
+ EMBEDDING_MODEL_NAME = "sentence-transformers/paraphrase-multilingual-mpnet-base-v2" # <--- 修改这里!
22
 
23
  # 1. 轻量 LLM(uer/gpt2-chinese-cluecorpussmall)
24
  print("🔧 加载生成模型...")