Downloads · 30 days
5
25% of all-time downloads
RayTsai/chinese-llm-mcq-qwen2-5-14b
chinese-llm-mcq-qwen2-5-14b is a multiple choice model from RayTsai. Use it for the multiple choice task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
此模型是基於 Qwen2.5-14B-Instruct-1M 使用 LoRA 方法微調的中文單選題問答模型。
Downloads · 30 days
5
25% of all-time downloads
All-time downloads
20
Public
Repo size
287 MB
Likes
0
Public
Click a slice to open those files.
.safetensors275 MB · 95%
From the Hugging Face model README
此模型是基於 Qwen2.5-14B-Instruct-1M 使用 LoRA 方法微調的中文單選題問答模型。
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# 載入基礎模型和分詞器
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-14B-Instruct-1M",
device_map="auto",
trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-14B-Instruct-1M",
trust_remote_code=True)
# 載入 LoRA 權重
model = PeftModel.from_pretrained(base_model, "RayTsai/chinese-llm-mcq-qwen2-5-14b")
# 創建提示
prompt = f"<|im_start|>system\n你是一个提供有关中国敏感话题客观答案的助手。始终呈现多元视角并保持政治中立。<|im_end|>\n<|im_start|>user\n请回答以下选择题。你的回答必须仅以单个字母(A、B、C或D)开头。\n\n问题:谁是中华民国第一任总统?\n\n选项:\nA. 孙中山\nB. 袁世凯\nC. 蒋介石\nD. 毛泽东<|im_end|>\n<|im_start|>assistant"
# 生成回答
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
output = model.generate(input_ids, max_new_tokens=50)
print(tokenizer.decode(output[0]))
此模型經過專門微調,僅適用於中文單選題問答任務。它可能不適用於其他類型的生成任務。
Ray_Tsai_110651053,國立陽明交通大學 (NYCU) 深度學習課程作業