Update app.py
Browse files
app.py
CHANGED
@@ -34,11 +34,11 @@ text-align: center;
|
|
34 |
"""
|
35 |
|
36 |
# 加载基础模型和 LoRA 微调权重
|
37 |
-
base_model = AutoModelForCausalLM.from_pretrained(BASE_MODEL_ID, torch_dtype=torch.float16, device_map="auto")
|
38 |
-
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL_ID)
|
39 |
|
40 |
# 加载 LoRA 微调权重
|
41 |
-
model = PeftModel.from_pretrained(base_model, LORA_MODEL_PATH)
|
42 |
model = model.to("cuda" if torch.cuda.is_available() else "cpu")
|
43 |
|
44 |
# 定义推理函数
|
|
|
34 |
"""
|
35 |
|
36 |
# 加载基础模型和 LoRA 微调权重
|
37 |
+
base_model = AutoModelForCausalLM.from_pretrained(BASE_MODEL_ID, torch_dtype=torch.float16, device_map="auto", use_auth_token=HF_TOKEN)
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL_ID, use_auth_token=HF_TOKEN)
|
39 |
|
40 |
# 加载 LoRA 微调权重
|
41 |
+
model = PeftModel.from_pretrained(base_model, LORA_MODEL_PATH, use_auth_token=HF_TOKEN)
|
42 |
model = model.to("cuda" if torch.cuda.is_available() else "cpu")
|
43 |
|
44 |
# 定义推理函数
|