SpecTutor-0.5B / README.md
TingWang's picture
Update README.md
a6850bd verified
|
Raw
History Blame Contribute Delete
2 kB
---
license: mit
language:
- en
- zh
base_model:
- Qwen/Qwen1.5-0.5B-Chat
tags:
- medical
---
# Qwen1.5-0.5B Special Education Distill Model
This is a LoRA fine-tuned model based on Qwen1.5-0.5B-Chat, specifically designed for the field of special education. It supports text generation tasks related to early signs of autism and other related scenarios.
- Author:Ting Wang(王霆)
- Homepage:[https://github.com/WANG-TRAJECTORY](https://rick-ting-wang.github.io)
## Model Introduction
- Base Model: Qwen1.5-0.5B-Chat([Model Link](https://huggingface.co/Qwen/Qwen1.5-0.5B-Chat))
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- Training Data: Instruction-response pairs related to special education (e.g., early manifestations of autism)
- Intended Use: Question answering and teaching assistance in special education scenarios
## Example Usage
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# 加载基础模型和tokenizer
base_model = "Qwen/Qwen1.5-0.5B-Chat"
tokenizer = AutoTokenizer.from_pretrained(base_model, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# 加载LoRA适配器
model = PeftModel.from_pretrained(model, "TingWang/SpecTutor-0.5B")
model.eval()
# 构造输入
messages = [
{"role": "system", "content": "你是一个特殊教育老师。"},
{"role": "user", "content": "我和别人不一样吗?"}
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
# 生成回复
with torch.no_grad():
output = model.generate(
input_ids=input_ids,
max_new_tokens=256,
do_sample=True,
top_p=0.95,
temperature=0.8
)
response = tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True)
print("模型回答:", response)# Qwen1.5-0.5B Special Education Distill Model