ClosedCharacter commited on
Commit
a60d438
·
verified ·
1 Parent(s): 6ccfae2

Create README_zh.md

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