Downloads · 30 days
60
10% of all-time downloads
CyberpunkLegend/Qwen2.5-7B-Instruct-CharacterEnhance
Qwen2.5-7B-Instruct-CharacterEnhance is a text generation model from CyberpunkLegend. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
基于 Qwen2.5-7B-Instruct 进行 QLoRA 微调的角色扮演对话模型,支持中英双语。训练数据为 PIPPA 数据集。
Downloads · 30 days
60
10% of all-time downloads
All-time downloads
599
Public
Parameters
7.6B
15.2 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
基于 Qwen2.5-7B-Instruct 进行 QLoRA 微调的角色扮演对话模型,支持中英双语。训练数据为 PIPPA 数据集。
模型能够在角色扮演对话中生成自然、符合角色设定的回复。
from transformers import pipeline
generator = pipeline(
"text-generation",
model="Qwen2.5-7B-Instruct-CharacterEnhance",
device="cuda",
)
messages = [
{
"role": "system",
"content": "You are a helpful role-play assistant. Respond in character based on the given persona and conversation history."
},
{
"role": "user",
"content": "现在需要你来扮演角色并继续角色和用户之间的闲聊...\n\n<|角色信息-开始|>\n[你扮演的角色的角色信息]\n姓名:小明,性格开朗的大学生\n\n[用户信息]\n朋友\n<|角色信息-结束|>\n\n<|对话上文-开始|>\nuser: 周末一起去爬山吗?\nassistant: (眼睛一亮)好啊好啊!我最近正想出去走走呢。\n<|对话上文-结束|>"
}
]
output = generator(messages, max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
| 参数 | 值 |
|---|---|
| 基座模型 | Qwen2.5-7B-Instruct |
| 训练方法 | QLoRA (4-bit NF4 quantization) |
| LoRA Rank (r) | 8 |
| LoRA Alpha | 16 |
| LoRA Dropout | 0 |
| 最大序列长度 | 2048 |
| Epochs | 1 |
| Batch Size | 2 |
| 梯度累积 | 1 |
| 学习率 | 5e-5 |
| 学习率调度 | Cosine with 3% warmup |
| 优化器 | AdamW 8-bit |
| 随机种子 | 13 |
| 训练样本 | 3,044 (1,522 EN + 1,522 ZH) |
| 总步数 | 1,446 |
| 最终 Eval Loss | 1.9628 |
| 硬件 | RTX 5080 16GB |
| 训练耗时 | ~45 分钟 |
PIPPA 是一个大规模人机角色扮演对话数据集。训练样本从 16,832 条去重对话中提取,经过质量过滤和分层采样。同时使用了英文原文和中文译文来构建双语训练集。
本模型继承自 Qwen2.5-7B-Instruct 的 Apache 2.0 许可。
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}
A QLoRA fine-tuned version of Qwen2.5-7B-Instruct for bilingual (English & Chinese) character role-play dialogue generation. Trained on the PIPPA dataset.
The model generates natural, character-consistent responses in role-play conversations.
from transformers import pipeline
generator = pipeline(
"text-generation",
model="Qwen2.5-7B-Instruct-CharacterEnhance",
device="cuda",
)
messages = [
{
"role": "system",
"content": "You are a helpful role-play assistant. Respond in character based on the given persona and conversation history."
},
{
"role": "user",
"content": "Now, you are required to role-play and continue the casual chat...\n\n<|Character information-begin|>\n[Character information of the character you play]\nName: Alex, a cheerful college student\n\n[User information]\nFriend\n<|Character information-end|>\n\n<|Dialogue context-begin|>\nuser: Want to go hiking this weekend?\nassistant: (Eyes light up) Yes! I've been wanting to get outdoors lately.\n<|Dialogue context-end|>"
}
]
output = generator(messages, max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
| Parameter | Value |
|---|---|
| Base Model | Qwen2.5-7B-Instruct |
| Training Method | QLoRA (4-bit NF4 quantization) |
| LoRA Rank (r) | 8 |
| LoRA Alpha | 16 |
| LoRA Dropout | 0 |
| Max Sequence Length | 2048 |
| Epochs | 1 |
| Batch Size | 2 |
| Gradient Accumulation | 1 |
| Learning Rate | 5e-5 |
| LR Schedule | Cosine with 3% warmup |
| Optimizer | AdamW 8-bit |
| Seed | 13 |
| Training Samples | 3,044 (1,522 EN + 1,522 ZH) |
| Total Steps | 1,446 |
| Final Eval Loss | 1.9628 |
| Hardware | RTX 5080 16GB |
| Training Time | ~45 minutes |
PIPPA (Personal Interaction Pairs between People and AI), a large-scale dataset of human-AI role-play dialogues. Training samples were extracted from 16,832 deduplicated dialogues with quality filtering and stratified sampling. Both English originals and Chinese translations were used to create a bilingual training set.
This model inherits Apache 2.0 from Qwen2.5-7B-Instruct.
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}