基于 Qwen/Qwen3-0.6B 通过 SFT(LoRA) 微调得到的汽车售后服务场景客服助手适配器。
r=8,alpha=8,dropout=0.05q_proj / k_proj / v_proj / o_proj / gate_proj / up_proj / down_projfrom transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_name = "Qwen/Qwen3-0.6B"
adapter_path = "zhongzhanqiu/car-customer-service-sft-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype="auto",
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_path)
messages = [{"role": "user", "content": "我的车最近启动时发动机有异响,应该怎么办?"}]
text = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
| 文件 | 说明 |
|---|---|
adapter_model.safetensors |
LoRA 适配器权重 |
adapter_config.json |
PEFT 适配器配置 |
tokenizer.json / tokenizer_config.json |
分词器文件 |
chat_template.jinja |
对话模板 |
sft_config.json |
SFT 训练数据规模配置 |
Qwen/Qwen3-0.6B