Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
19 |
-
|
20 |
-
|
|
|
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("🔧 加载生成模型...")
|