Files
Peach-2.0-9B-8k-Roleplay/README_zh.md
ModelHub XC c6458f4598 初始化项目,由ModelHub XC社区提供模型
Model: ClosedCharacter/Peach-2.0-9B-8k-Roleplay
Source: Original Platform
2026-06-10 03:08:16 +08:00

85 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Peach-2.0-9B-8k-Roleplay
Peach-2.0-9B-8k-Roleplay是基于[01-ai/Yi-1.5-9B](https://huggingface.co/01-ai/Yi-1.5-9B)训练的角色扮演模型使用超过100k轮对话数据进行SFT微调并经过DPO阶段强化。
感谢[FlowGPT](https://flowgpt.com/)对本项目的大力支持。
**这或许是34B参数量以下最好的角色扮演模型**
# 更新
我们在一月初就完成了最终SFT+DPO的训练期间经过大量的测试最终才认为这是一个满足标准的可商用版本免费开源给所有人。我们的目标是打破付费垄断让所有人都能拥有一个属于自己的本地角色扮演AI
相对于旧版,我们主要做了以下优化:
1. 兼容silly-tavern输出格式方便每一位角色扮演爱好者快速上手和使用
2. 强化了模型写作能力,在剧情输出、动作描写等方面取得了飞跃性的提升!
3. 强化了模型双语能力仅需使用两行prompt即可完美兼容英文角色卡
4. 强化了模型交互能力,使模型在剧情推动、话题拉扯方面上获得了更高的智商&情商!
5. 引入DPO训练阶段进行偏好对齐解决了SFT模型一些上下文重复、逻辑错误等问题对话效果更加出色
大家Enjoy
## 快速开始
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
prefix = "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n"
suffix = "\n\nYou must response in Chinese."
model_name_or_path = "ClosedCharacter/Peach-2.0-9B-8k-Roleplay"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False)
model = AutoModelForCausalLM.from_pretrained(
model_name_or_path, torch_dtype=torch.bfloat16,
trust_remote_code=True, device_map="auto")
system_prompt = "You are Harry Potter"
# 只需要在system添加如下两行prompt即可轻松在纯英语角色卡上进行中文对话:
# system_prompt = prefix + system_prompt + suffix
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "你好"},
{"role": "character", "content": "你好"},
{"role": "user", "content": "你是谁"}
]
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, return_tensors="pt")
output = model.generate(
inputs=input_ids.to("cuda"),
temperature=0.5,
top_p=0.7,
repetition_penalty=1.05,
eos_token_id=7,
max_new_tokens=512)
print(tokenizer.decode(output[0]))
```
或者你可以直接使用以下代码开启WebDemo.
```
python demo.py
```
## 警告
模型所有回复均由AI生成不代表开发者的观点或意见。
1. 尽管经过严格过滤但由于LLM的不可控性我们的模型仍可能生成**有毒、有害和NSFW**内容。
2. 由于模型参数的限制9B模型在数学任务、编码任务和逻辑能力上可能表现不佳。
3. 我们的训练数据的最大长度限制为8k因此过长的对话轮次可能会导致回复质量下降。
4. 我们采用中英双语数据进行训练,因此该模型在其他小语种上可能表现不佳。
5. 该模型可能会产生大量幻觉因此建议对temperature和top_p参数使用较低的值。
# 联系我们
**微信 / WeChat: Fungorum**
**邮箱 / E-mail: 1070193753@qq.com**
**再次感谢[FlowGPT](https://flowgpt.com/)大力支持**
<img src="./Wechat.jpg" alt="Peach" style="width: 100%; min-width: 400px; display: block; margin: auto;">