Update app.py
Browse files
app.py
CHANGED
@@ -6,14 +6,16 @@ import re
|
|
6 |
# 加载医学诊断模型
|
7 |
# 修改后(正确)
|
8 |
# from transformers import LlamaForSequenceClassification, LlamaTokenizer
|
9 |
-
from transformers import
|
10 |
import torch
|
11 |
|
12 |
-
# ====
|
13 |
-
#
|
14 |
-
|
|
|
|
|
15 |
"unsloth/DeepSeek-R1-Distill-Llama-8B",
|
16 |
-
config=
|
17 |
trust_remote_code=True
|
18 |
)
|
19 |
|
@@ -21,7 +23,7 @@ model = AutoModelForSequenceClassification.from_pretrained(
|
|
21 |
model.load_adapter("yxccai/ds-ai-app")
|
22 |
|
23 |
# ==== 加载分词器 ===-
|
24 |
-
tokenizer =
|
25 |
|
26 |
# 2. 加载你的适配器
|
27 |
# model.load_adapter("yxccai/ds-ai-app") # 替换为你的仓库名
|
|
|
6 |
# 加载医学诊断模型
|
7 |
# 修改后(正确)
|
8 |
# from transformers import LlamaForSequenceClassification, LlamaTokenizer
|
9 |
+
from transformers import LlamaForSequenceClassification, LlamaTokenizer, LlamaConfig
|
10 |
import torch
|
11 |
|
12 |
+
# ==== 加载本地修正配置 ====
|
13 |
+
config = LlamaConfig.from_pretrained("./fixed_config") # 关键修改:强制本地配置
|
14 |
+
|
15 |
+
# ==== 加载基础模型 ====
|
16 |
+
model = LlamaForSequenceClassification.from_pretrained(
|
17 |
"unsloth/DeepSeek-R1-Distill-Llama-8B",
|
18 |
+
config=config, # 注入修正配置
|
19 |
trust_remote_code=True
|
20 |
)
|
21 |
|
|
|
23 |
model.load_adapter("yxccai/ds-ai-app")
|
24 |
|
25 |
# ==== 加载分词器 ===-
|
26 |
+
tokenizer = LlamaTokenizer.from_pretrained("yxccai/ds-ai-app")
|
27 |
|
28 |
# 2. 加载你的适配器
|
29 |
# model.load_adapter("yxccai/ds-ai-app") # 替换为你的仓库名
|