silk-road commited on
Commit
203fd9b
1 Parent(s): 6754b61

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ datasets:
4
+ - silk-road/ChatHaruhi-Expand-118K
5
+ language:
6
+ - zh
7
+ - en
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - text-generation-inference
11
+ ---
12
+
13
+ 本脚本是对千问1.8B模型的微调和测试,使得Qwen 1.8B能够有角色扮演的能力
14
+
15
+ This script fine-tunes and tests the Qwen 1.8B model to give Qwen 1.8B the capability of role playing.
16
+
17
+ - 118K训练数据由李鲁鲁收集,
18
+
19
+ - 模型是由[豆角](https://github.com/goodnessSZW)训练的
20
+
21
+ - Qwen inference代码由米唯实编写,
22
+
23
+ - 李鲁鲁编写了ChatHaruhi内部的prompt组织函数
24
+
25
+
26
+ 使用方法
27
+
28
+ 载入函数
29
+
30
+ ```python
31
+ from transformers import AutoTokenizer, AutoModel, AutoModelForCausalLM
32
+ tokenizer = AutoTokenizer.from_pretrained("silk-road/Chat-Haruhi_qwen_1_8", trust_remote_code=True)
33
+ model = AutoModelForCausalLM.from_pretrained("silk-road/Chat-Haruhi_qwen_1_8", trust_remote_code=True).half().cuda()
34
+ model = model.eval()
35
+ ```
36
+
37
+ 具体看https://github.com/LC1332/Chat-Haruhi-Suzumiya/blob/main/notebook/ChatHaruhi_x_Qwen1_8B.ipynb 这个notebook
38
+
39
+ ```python
40
+ from ChatHaruhi import ChatHaruhi
41
+
42
+ chatbot = ChatHaruhi( role_name = 'haruhi', max_len_story = 1000 )
43
+
44
+ prompt = chatbot.generate_prompt(role='阿虚', text = '我看新一年的棒球比赛要开始了!我们要去参加吗?')
45
+
46
+ response, history = model.chat(tokenizer, prompt, history=[])
47
+ print(response)
48
+
49
+ chatbot.append_response(response)
50
+ ```
51
+
52
+ 目前支持
53
+ role_name
54
+
55
+ role_from_hf
56
+
57
+ role_from_jsonl
58
+
59
+ 多种角色格式载入。
60
+