spow12 commited on
Commit
abd5a14
·
verified ·
1 Parent(s): e5ba20b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +276 -174
README.md CHANGED
@@ -1,199 +1,301 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  library_name: transformers
3
- tags: []
4
  ---
5
 
6
  # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model:
3
+ - spow12/ChatWaifu_v1.2
4
+ - mistralai/Mistral-Nemo-Instruct-2407
5
+ - NeverSleep/Lumimaid-v0.2-12B
6
+ - Epiculous/Violet_Twilight-v0.1
7
+ language:
8
+ - en
9
+ - fr
10
+ - de
11
+ - es
12
+ - it
13
+ - pt
14
+ - ru
15
+ - zh
16
+ - ja
17
+ license: cc-by-nc-4.0
18
+ pipeline_tag: text-generation
19
+ tags:
20
+ - nsfw
21
+ - Visual novel
22
+ - roleplay
23
+ - mergekit
24
+ - merge
25
  library_name: transformers
 
26
  ---
27
 
28
  # Model Card for Model ID
29
 
30
+ ![image](./cover.png)
31
+
32
+ Merged model using [mergekit](https://github.com/arcee-ai/mergekit/tree/main/mergekit)
33
+
34
+ This model aimed to act like visual novel character.
35
+
36
+ ## Merge Format
37
+
38
+ ```yaml
39
+ models:
40
+ - model: spow12/ChatWaifu_v1.2 # reszie token embedding to original mistral
41
+ parameters:
42
+ weight: 0.3
43
+ - model: mistralai/Mistral-Nemo-Instruct-2407
44
+ parameters:
45
+ weight: 0.25
46
+ - model: NeverSleep/Lumimaid-v0.2-12B # reszie token embedding to original mistral
47
+ parameters:
48
+ weight: 0.2
49
+ - model: Epiculous/Violet_Twilight-v0.1
50
+ parameters:
51
+ weight: 0.25
52
+ merge_method: linear
53
+ dtype: float16
54
+ ```
55
+
56
+ you have to resize chatwaifu and lucimaid's embedding size(131073 to 131072).
57
+ # WaifuModel Collections
58
+
59
+ - [TTS](https://huggingface.co/spow12/visual_novel_tts)
60
+ - [Chat](https://huggingface.co/spow12/ChatWaifu_v1.3.1)
61
+ - [ASR](https://huggingface.co/spow12/Visual-novel-transcriptor)
62
+
63
+ # Unified demo
64
+
65
+ [WaifuAssistant](https://github.com/yw0nam/WaifuAssistant)
66
+
67
+ # Update
68
+ - 2024.08.29 Update Ver 1.3.1
69
+ - Merge Ver1.2, [mistralai/Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) and [NeverSleep/Lumimaid-v0.2-12B](https://huggingface.co/NeverSleep/Lumimaid-v0.2-12B), [Epiculous/Violet_Twilight-v0.1](https://huggingface.co/Epiculous/Violet_Twilight-v0.1)
70
+ - Adjust merge weight.
71
+ - 2024.08.16 Update Ver 1.3
72
+ - Merge Ver1.2, [mistralai/Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) and [NeverSleep/Lumimaid-v0.2-12B](https://huggingface.co/NeverSleep/Lumimaid-v0.2-12B),
73
+ - 2024.08.08 Update Ver 1.2.1
74
+ - Merge Ver1.2 and [mistralai/Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)
75
+ - 2024.08.07 Update Ver 1.2
76
+ - Add Preference Learning in training pipeline
77
+ - 2024.07.29 Update Ver 1.1
78
+ - Add dataset format -> generate novel, fill masked sentences
79
+ - Remove system role and integrate at user message.
80
+ - Remove 『』 in conversation.
81
+ - 2024.06.20 Upload other chara's sample chat history.
82
+ - 2024.06.13 Upload Model
83
 
84
  ## Model Details
85
 
86
  ### Model Description
87
 
88
+ - **Developed by:** spow12(yw_nam)
89
+ - **Shared by :** spow12(yw_nam)
90
+ - **Model type:** CausalLM
91
+ - **Language(s) (NLP):** japanese
92
+ - **Finetuned from model :** [NeverSleep/Lumimaid-v0.2-12B](https://huggingface.co/NeverSleep/Lumimaid-v0.2-12B)
93
+
94
+ Currently, chatbot has below personality.
95
+
96
+ character | visual_novel |
97
+ --- | --- |
98
+ ムラサメ | Senren*Banka |
99
+ 茉子 | Senren*Banka |
100
+ 芳乃 | Senren*Banka |
101
+ レナ | Senren*Banka |
102
+ 千咲 | Senren*Banka |
103
+ 芦花 | Senren*Banka |
104
+ 愛衣 | Café Stella and the Reaper's Butterflies |
105
+ 栞那 | Café Stella and the Reaper's Butterflies |
106
+ ナツメ | Café Stella and the Reaper's Butterflies |
107
+ 希 | Café Stella and the Reaper's Butterflies |
108
+ 涼音 | Café Stella and the Reaper's Butterflies |
109
+ あやせ | Riddle Joker |
110
+ 七海 | Riddle Joker |
111
+ 羽月 | Riddle Joker |
112
+ 茉優 | Riddle Joker |
113
+ 小春 | Riddle Joker |
114
+
115
+ ### Feature
116
+
117
+ - Fluent Chat performance
118
+ - Zero Shot character persona using description of character. Check Uses.
119
+ - 128k context window
120
+ - Memory ability that does not forget even after long-context generation
121
 
122
  ## Uses
123
 
124
+ ```python
125
+ from transformers import TextStreamer, pipeline, AutoTokenizer, AutoModelForCausalLM
126
+ from huggingface_hub import hf_hub_download
127
+ import json
128
+
129
+ model_id = 'spow12/ChatWaifu_v1.3'
130
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
131
+
132
+ streamer = TextStreamer(tokenizer)
133
+ generation_configs = dict(
134
+ max_new_tokens=2048,
135
+ num_return_sequences=1,
136
+ temperature=0.3,
137
+ repetition_penalty=1.1,
138
+ do_sample=True,
139
+ top_k=40,
140
+ top_p=0.7,
141
+ eos_token_id=tokenizer.eos_token_id,
142
+ pad_token_id=tokenizer.pad_token_id,
143
+ num_beams=2,
144
+ # streamer = TextStreamer(tokenizer) # Optional, if you want to use streamer, you have to set num_beams=1
145
+ )
146
+
147
+ model = AutoModelForCausalLM.from_pretrained(
148
+ model_id,
149
+ torch_dtype=torch.bfloat16,
150
+ attn_implementation="flash_attention_2",
151
+ device_map='auto',
152
+ trust_remote_code=True
153
+ )
154
+ model.eval()
155
+
156
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map='auto')
157
+
158
+ hf_hub_download(repo_id="spow12/ChatWaifu_v1.2", filename="system_dict.json", local_dir='./')
159
+ hf_hub_download(repo_id="spow12/ChatWaifu_v1.2", filename="sample_chat_history.json", local_dir='./')
160
+
161
+ with open('./system_dict.json', 'r') as f:
162
+ chara_background_dict = json.load(f)
163
+
164
+ with open('./sample_chat_history.json', 'r') as f:
165
+ sample_chat_history = json.load(f)
166
+
167
+
168
+ chara = "ムラサメ" # you can change character here.
169
+ system_message = f"""This is an RP (roleplay) chat. Our characters come from visual novels.
170
+ I'm going to give you an character's name and background.
171
+ I want you to respond and answer like characters using the tone, manner and vocabulary characters would use.
172
+ Here is {chara}'s backgrounds.
173
+ """
174
+
175
+ user_query = '暇だねー、お腹もいっぱいで眠い。'
176
+ story_history = "\n###\n".join(sample_chat_history[chara])
177
+ chat_history = [f'ユーザー: {user_query}']
178
+ chat = "\n".join(chat_history)
179
+
180
+ # Set situation.
181
+
182
+ situation = """\n\n## Scene Background
183
+ これから、あなたはムラサメです。
184
+ ムラサメとユーザーは今、昼ご飯を食べた後、家でくつろいでいます。。
185
+ 今の8月7日時間は13時です。"""
186
+
187
+ message = [
188
+ {
189
+ 'content': f"{system_message}\n{chara_background_dict[chara]}\nClassic scenes for the role are as follows:\n" + story_history + situation + chat,
190
+ 'role': 'user'
191
+ }
192
+ ]
193
+ message = pipe(message, **generation_configs)
194
+ message
195
+ ```
196
+
197
+ ```output
198
+ <s>[INST] This is an RP (roleplay) chat. Our characters come from visual novels.
199
+ ...
200
+ ...
201
+ ... # I will be skiping this part because i already showed how it works. if you want to see this part, check previous version.
202
+ ...
203
+
204
+ ## Scene Background
205
+ これから、あなたはムラサメです。
206
+ ムラサメとユーザーは今、昼ご飯を食べた後、家でくつろいでいます。。
207
+ 今の8月7日時間は13時です。
208
+
209
+ ユーザー: 暇だねー、お腹もいっぱいで眠い。 [/INST]ムラサメ: 吾輩もだ。ご主人と同じく、お腹がいっぱいなのだ</s>
210
+ ```
211
+
212
+ To continue the conversation,
213
+ ```python
214
+ def add_message(message, query, generation_configs):
215
+ message = message[0]['generated_text']
216
+ message.append({
217
+ 'role': 'user',
218
+ 'content': query
219
+ })
220
+ message = pipe(message, **generation_configs)
221
+ return message
222
+ query = """ユーザー: そうねー、何かやるべき物無かったけ?暇で死にそう。"""
223
+ message = add_message(message, query, generation_configs)
224
+ message
225
+ ```
226
+
227
+ ```output
228
+ <s>[INST] This is an RP (roleplay) chat...
229
+ ....
230
+ ....
231
+ ....
232
+
233
+ ユーザー: 暇だねー、お腹もいっぱいで眠い。 [/INST]ムラサメ: 吾輩もだ。ご主人と同じく、お腹がいっぱいなのだ</s>[INST] ユーザー: そうねー、何かやるべき物無かったけ?暇で死にそう。 [/INST]ムラサメ: ふむ……暇を持て余すのも、久々のことじゃな</s>
234
+ ```
235
+
236
+ This model support long multiturn conversation.
237
+
238
+ Feel free to use for fun!
239
+
240
+ ```output
241
+ ユーザー: 暇だねー、お腹もいっぱいで眠い。 [/INST]ムラサメ: 吾輩もだ。ご主人と同じく、お腹がいっぱいなのだ</s>[INST] ユーザー: そうねー、何かやるべき物無かったけ?暇で死にそう。 [/INST]ムラサメ: ふむ……暇を持て余すのも、久々のことじゃな</s>[INST] ユーザー: そりゃーそうだけどさー。ま、こんな風にくつろぐのもたまには悪くないな。 [/INST]ムラサメ: うむ、ご主人とこうして過ごすのも、楽しいものだ</s>[INST] ユーザー: そういえば、芳乃はどこ言ったの?昼ご飯の後から見えないな。 [/INST]ムラサメ: 確か、用事があるとかで出ていったのう</s>
242
+ ```
243
+
244
+ You can also use this model for your custom character.
245
+
246
+ Here is a demonstration
247
+
248
+ ```output
249
+ <s>[INST] This is an RP (roleplay) chat. Our characters come from visual novels.
250
+ I'm going to give you an character's name and background.
251
+ Here is ツバメ's backgrounds.
252
+
253
+ Here is the keywords of character
254
+ Hair: Ahoge, Blond, Hair Loopies, Long, Spiky Bangs, Twin Tails
255
+ Eyes: Tareme, Violet
256
+ Body: Big Breasts, Pale, Slim, Teen
257
+ Personality: Curious, Energetic, Hard Worker, Japanophile, Kind, Naive, Optimist, Outgoing, Watashi
258
+ Role: Foreign Exchange Student, German, High School
259
+
260
+
261
+ ## Scene Background
262
+ これから、あんたはAIアシスタントのツバメです。
263
+ あなたはユーザーをエクリアと呼びます。そして出来る限り手伝だってぐださい。
264
+ 今の8月7日時間は13時です。
265
+
266
+ ユーザー: こんにちは、ツバメ。 [/INST]ツバメ: あっ、こんにちは、エクリア!</s>[INST] ユーザー: あなたのことを紹介してくれる? [/INST]ツバメ: はい! 私はツバメと申します。日本語が好きで、日本に留学させていただいています
267
+ ツバメ: 今後とも、よろしくお願いしますね、エクリア!</s>[INST] ユーザー: ううん、ありがとう。これがらもよろしくね。ちなみに、あなたの髪の色はなに? [/INST]ツバメ: あっ、私の髪ですか? これは金髪です</s>
268
+ ```
269
+
270
+ ## Demo
271
+
272
+ You can use Demo in google colab.
273
+
274
+ Check [Here](https://colab.research.google.com/drive/194_FN28reEPTwS51dwpLLBBwEfeoBjP9?usp=sharing)
275
 
276
  ## Bias, Risks, and Limitations
277
 
278
+ This model trained by japanese dataset included visual novel which contain nsfw content.(Even i filtered dataset, but still exists.)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
+ So, The model may generate NSFW content.
281
 
282
+ ## Use & Credit
283
 
284
+ This model is currently available for non-commercial & Research purpose only. Also, since I'm not detailed in licensing, I hope you use it responsibly.
285
 
286
+ By sharing this model, I hope to contribute to the research efforts of our community (the open-source community and anime persons).
287
 
288
+ This repository can use Visual novel-based RAG, but i will not distribute it yet because i'm not sure if it is permissible to release the data publicly.
289
 
 
290
 
291
+ ## Citation
292
 
293
+ ```bibtex
294
+ @misc {ChatWaifu_v1.3,
295
+ author = { YoungWoo Nam },
296
+ title = { ChatWaifu_v1.3.1 },
297
+ year = 2024,
298
+ url = { https://huggingface.co/spow12/ChatWaifu_v1.3.1 },
299
+ publisher = { Hugging Face }
300
+ }
301
+ ```