rAIfle commited on
Commit
a95a6b9
1 Parent(s): 9ecb41c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +273 -0
README.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - unsloth
7
+ - axolotl
8
+ license: cc-by-nc-nd-4.0
9
+ ---
10
+
11
+ ```
12
+ e88 88e d8
13
+ d888 888b 8888 8888 ,"Y88b 888 8e d88
14
+ C8888 8888D 8888 8888 "8" 888 888 88b d88888
15
+ Y888 888P Y888 888P ,ee 888 888 888 888
16
+ "88 88" "88 88" "88 888 888 888 888
17
+ b
18
+ 8b,
19
+
20
+ e88'Y88 d8 888
21
+ d888 'Y ,"Y88b 888,8, d88 ,e e, 888
22
+ C8888 "8" 888 888 " d88888 d88 88b 888
23
+ Y888 ,d ,ee 888 888 888 888 , 888
24
+ "88,d88 "88 888 888 888 "YeeP" 888
25
+
26
+ PROUDLY PRESENTS
27
+ ```
28
+ # dreamgen-opus-v1.2-70b-exl2-rpcal
29
+ Quantized using 200 samples of 8192 tokens from an RP-oriented [PIPPA](https://huggingface.co/datasets/royallab/PIPPA-cleaned) dataset.
30
+
31
+ Branches:
32
+ - `main` -- `measurement.json`
33
+ - `4.65b6h` -- 4.65bpw, 6bit lm_head
34
+
35
+ Original model link: [dreamgen/opus-v1.2-70b](https://huggingface.co/dreamgen/opus-v1.2-70b)
36
+
37
+ Original model README below.
38
+
39
+ -----
40
+
41
+ # DreamGen Opus V1
42
+
43
+ <div style="display: flex; flex-direction: row; align-items: center;">
44
+ <img src="https://huggingface.co/dreamgen/opus-v1.2-70b/resolve/main/images/logo-1024.png" alt="model logo" style="
45
+ border-radius: 12px;
46
+ margin-right: 12px;
47
+ margin-top: 0px;
48
+ margin-bottom: 0px;
49
+ max-width: 100px;
50
+ height: auto;
51
+ "/>
52
+
53
+ Models for **(steerable) story-writing and role-playing**.
54
+ <br/>[All Opus V1 models, including quants](https://huggingface.co/collections/dreamgen/opus-v1-65d092a6f8ab7fc669111b31).
55
+
56
+ </div>
57
+
58
+ ## Resources
59
+
60
+ - [**Opus V1 prompting guide**](https://dreamgen.com/docs/models/opus/v1) with many (interactive) examples and prompts that you can copy.
61
+ - [**Google Colab**](https://colab.research.google.com/drive/1J178fH6IdQOXNi-Njgdacf5QgAxsdT20?usp=sharing) for interactive role-play using `opus-v1.2-7b`.
62
+ - [Python code](example/prompt/format.py) to format the prompt correctly.
63
+ - Join the community on [**Discord**](https://dreamgen.com/discord) to get early access to new models.
64
+
65
+ <img src="https://huggingface.co/dreamgen/opus-v1.2-70b/resolve/main/images/story_writing.webp" alt="story writing on dreamgen.com" style="
66
+ padding: 12px;
67
+ border-radius: 12px;
68
+ border: 2px solid #f9a8d4;
69
+ background: rgb(9, 9, 11);
70
+ "/>
71
+
72
+ ## Prompting
73
+
74
+ <details>
75
+ <summary>The models use an extended version of ChatML.</summary>
76
+
77
+ ```
78
+ <|im_start|>system
79
+ (Story description in the right format here)
80
+ (Typically consists of plot description, style description and characters)<|im_end|>
81
+ <|im_start|>user
82
+ (Your instruction on how the story should continue)<|im_end|>
83
+ <|im_start|>text names= Alice
84
+ (Continuation of the story from the Alice character)<|im_end|>
85
+ <|im_start|>text
86
+ (Continuation of the story from no character in particular (pure narration))<|im_end|>
87
+ <|im_start|>user
88
+ (Your instruction on how the story should continue)<|im_end|>
89
+ <|im_start|>text names= Bob
90
+ (Continuation of the story from the Bob character)<|im_end|>
91
+ ```
92
+
93
+ The Opus V1 extension is the addition of the `text` role, and the addition / modification of role names.
94
+
95
+ Pay attention to the following:
96
+
97
+ - The `text` messages can (but don't have to have) `names`, names are used to indicate the "active" character during role-play.
98
+ - There can be multiple subsequent message with a `text` role, especially if names are involved.
99
+ - There can be multiple names attached to a message.
100
+ - The format for names is `names= {{name[0]}}; {{name[1]}}`, beware of the spaces after `names=` and after the `;`. This spacing leads to most natural tokenization for the names.
101
+ </details>
102
+
103
+ While the main goal for the models is great story-writing and role-playing performance, the models are also capable of several writing related tasks as well as general assistance.
104
+
105
+ Here's how you can prompt the model for the following tasks
106
+
107
+ ### Steerable Story-writing and Role-playing:
108
+
109
+ - [Story-writing prompt guide](https://dreamgen.com/docs/models/opus/v1#task-story-writing)
110
+ - [Role-playing prompt guide](https://dreamgen.com/docs/models/opus/v1#task-role-playing)
111
+ - Input:
112
+ - System prompt: You provide story / role-play description, which consists of:
113
+ - Plot description
114
+ - Style description
115
+ - Characters and their descriptions
116
+ - Conversation turns:
117
+ - Text / message turn: This represents part of the story or role play
118
+ - Instruction: This tells the model what should happen next
119
+ - Output: Continuation of the story / role-play.
120
+
121
+ ### Story plot summarization
122
+
123
+ - [Prompt guide](https://dreamgen.com/docs/models/opus/v1#task-plot-description)
124
+ - Input: A story, or a few chapters of a story.
125
+ - Output: A description of the story or chapters.
126
+
127
+ #### Examples:
128
+
129
+ <details>
130
+ <summary>Summary of <a href="https://www.libraryofshortstories.com/onlinereader/the-last-incantation">short fiction story</a> in 50 words</summary>
131
+ <blockquote>
132
+ Malygris, a powerful magician, summons his long-dead lover Nylissa from the grave using necromancy. However, upon seeing her, he realizes that she is not the same person he once knew, leading him to question the nature of love, memory, and the power of magic.
133
+ </blockquote>
134
+ </details>
135
+ <details>
136
+ <summary>Summary of <a href="https://www.libraryofshortstories.com/onlinereader/the-last-incantation">short fiction story</a> in 200 words</summary>
137
+ <blockquote>
138
+ The story is a dark fantasy set in the city of Susran, where an ancient and powerful magician named Malygris dwells in a tower atop a conical hill. Malygris, who has mastered all forms of sorcery and necromancy, is plagued by a deep sense of ennui and melancholy. He seeks solace in the memory of Nylissa, a girl he once loved in his youth.
139
+
140
+ One day, Malygris decides to summon Nylissa's spirit from the grave using his necromantic powers. He performs the necessary rituals and incantations, and Nylissa appears before him as a ghostly apparition. However, as Malygris gazes upon her, he becomes increasingly disillusioned. He notices subtle changes in her appearance and behavior that do not match his memories of her. He begins to question whether this is truly the same Nylissa he once knew, or if it is just another illusion conjured by his magic.
141
+
142
+ As Malygris grapples with this uncertainty, he becomes increasingly despondent and disillusioned with life itself. He realizes that even his magic cannot bring back the past or make him truly happy. In the end, he dismisses Nylissa's spirit and returns to his lonely tower, resigned to his fate as an old and weary sorcerer.
143
+ </blockquote>
144
+
145
+ </details>
146
+ <details>
147
+ <summary>Summary of <a href="https://edition.cnn.com/2024/02/29/health/pets-diseases-viruses-bacteria-wellness/index.html">CNN News article</a> in 150 words</summary>
148
+ <blockquote>
149
+ The article discusses the recent human deaths from diseases transmitted by animals, specifically Alaskapox and bubonic plague. Dr. Leana Wen, an emergency physician and former Baltimore health commissioner, explains the various ways household pets can transmit diseases to humans. These include fecal-oral transmission, scratches and bites, and vector-borne diseases like ticks, fleas, and mosquitoes. Wen emphasizes the importance of vaccinating pets, maintaining cleanliness, and taking commonsense precautions to reduce disease transmission. She also advises that individuals who are immunocompromised, babies, and pregnant women should take additional care when interacting with animals.
150
+ </blockquote>
151
+ </details>
152
+ <details>
153
+ <summary>Summary of <a href="https://edition.cnn.com/2024/02/29/health/pets-diseases-viruses-bacteria-wellness/index.html">CNN News article</a> in 50 words</summary>
154
+ <blockquote>
155
+ A doctor discusses the risks of diseases transmitted from animals to humans, focusing on household pets like cats and dogs. They emphasize the importance of vaccination, hygiene, and regular veterinary care to prevent these illnesses.
156
+ </blockquote>
157
+ </details>
158
+
159
+ ### Story character description
160
+
161
+ - [Prompt guide](https://dreamgen.com/docs/models/opus/v1#task-char-description)
162
+ - Input: A story, or a few chapters of a story, set of characters.
163
+ - Output: A description of the characters.
164
+
165
+ #### Examples:
166
+
167
+ <details>
168
+ <summary>Description of the Malygris character from <a href="https://www.libraryofshortstories.com/onlinereader/the-last-incantation">this story</a> in 50 words</summary>
169
+ <blockquote>
170
+ Malygris is an ancient and powerful magician, characterized by his long white beard, cold green eyes, and a violet robe. He is a master of necromancy and possesses a vast knowledge of forbidden magic. Despite his immense power, he is plagued by a deep sense of melancholy and ennui.
171
+ </blockquote>
172
+ </details>
173
+
174
+ <details>
175
+ <summary>Description of the prince character from <a href="https://www.libraryofshortstories.com/onlinereader/the-pearl-of-love">this story</a> in 50 words</summary>
176
+ <blockquote>
177
+ The prince is a devoted and determined individual, driven by his love for his late queen. He is described as a graceful youth in the beginning, but as he grows older, his dedication to the Pearl of Love transforms him into a grave and intent man. His sense of color and design evolves over time, reflecting his growing maturity and artistic vision.
178
+ </blockquote>
179
+ </details>
180
+
181
+ ### Story style description
182
+
183
+ - [Prompt guide](https://dreamgen.com/docs/models/opus/v1#task-style-description)
184
+ - Input: A story, or a few chapters of a story.
185
+ - Output: A description the style of the story.
186
+
187
+ <details>
188
+ <summary>Style description of <a href="https://www.libraryofshortstories.com/onlinereader/the-last-incantation">this story</a></summary>
189
+ <blockquote>
190
+ The story is written in a descriptive and evocative style, with a focus on the atmosphere and setting. The author uses vivid and detailed language to create a sense of place and time, and employs a variety of literary devices such as similes, metaphors, and allusions to enhance the mood and tone of the narrative. The sentence structure is varied, with a mix of short and long sentences that create a rhythmic flow to the prose.
191
+ </blockquote>
192
+ </details>
193
+
194
+ <details>
195
+ <summary>Style description of <a href="https://www.libraryofshortstories.com/onlinereader/the-pearl-of-love">this story</a></summary>
196
+ <blockquote>
197
+ The writing style is descriptive and evocative, with a focus on the beauty and grandeur of the Pearl of Love. The author uses vivid imagery and sensory details to create a rich and immersive atmosphere. The tone is reverential and contemplative, reflecting the prince's deep love for his queen and his dedication to creating a lasting monument to her memory.
198
+ </blockquote>
199
+ </details>
200
+
201
+ ### Story description to chapters
202
+
203
+ - [Prompt guide](https://dreamgen.com/docs/models/opus/v1#task-story-description-to-chapter-descriptions)
204
+ - Input: A brief plot description and the desired number of chapters.
205
+ - Output: A description for each chapter.
206
+
207
+ ### And more...
208
+
209
+ ## Sampling params
210
+
211
+ For story-writing and role-play, I recommend "Min P" based sampling with `min_p` in the range `[0.01, 0.1]` and with `temperature` in the range `[0.5, 1.5]`, depending on your preferences. A good starting point would be `min_p=0.1; temperature=0.8`.
212
+
213
+ You may also benefit from setting presence, frequency and repetition penalties, especially at lower temperatures.
214
+
215
+ ## Dataset
216
+
217
+ The fine-tuning dataset consisted of ~100M tokens of steerable story-writing, role-playing, writing-assistant and general-assistant examples. Each example was up to 31000 tokens long.
218
+
219
+ All story-writing and role-playing examples were based on human-written text.
220
+
221
+ ![token count distribution](images/token_count_cum__token_bucket.png)
222
+
223
+ ## Running the model
224
+
225
+ The model is should be compatible with any software that supports the base model, but beware of prompting and tokenization.
226
+
227
+ I recommend using these model versions:
228
+
229
+ - 7B: [no quant (opus-v1.2-7b)](https://huggingface.co/dreamgen/opus-v1.2-7b)
230
+ - 34B: [no quant (opus-v1-34b)](https://huggingface.co/dreamgen/opus-v1-34b) or [awq (opus-v1-34b-awq)](https://huggingface.co/dreamgen/opus-v1-34b-awq)
231
+ - 70B: [no quant (opus-v1.2-70b)](https://huggingface.co/dreamgen/opus-v1.2-70b) or [awq (opus-v1.2-70b-awq)](https://huggingface.co/dreamgen/opus-v1.2-70b-awq)
232
+
233
+ ### Running on DreamGen.com (free)
234
+
235
+ You can run the models on [dreamgen.com](https://dreamgen.com) for free — you can use the built-in UI for story-writing & role-playing, or use [the API](https://dreamgen.com/docs/api).
236
+
237
+ ### Running Locally
238
+
239
+ - **Make sure your prompt is as close as possible to the Opus V1**
240
+ - Regardless of which backend you use, it's important that you format your prompt well and that the tokenization works correctly.
241
+ - [Read the prompt guide](https://dreamgen.com/docs/models/opus/v1)
242
+ - [Read the prompt formatting code](example/prompt/format.py)
243
+ - Make sure `<|im_start|>` and `<|im_end|>` are tokenized correctly
244
+ - **vLLM**
245
+ - [**Google Colab**](https://colab.research.google.com/drive/1J178fH6IdQOXNi-Njgdacf5QgAxsdT20?usp=sharing): This is a simple interactive Google Colab to do role-play with the 7B model, it should fit on the T4 GPU.
246
+ - [Code](example/prompt/interactive.py): This is simple script for interactive chat for one hard-coded scenario.
247
+ - **SillyTavern**
248
+ - [Official SillyTavern documentation for DreamGen](https://docs.sillytavern.app/usage/api-connections/dreamgen/) -- applies to both the API an local models
249
+ - SillyTavern (staging) comes with built-in DreamGen preset for RP
250
+ - Other presets can be found [here](https://huggingface.co/dreamgen/opus-v1.2-70b/tree/main/configs/silly_tavern), v2 kindly provided by @MarinaraSpaghetti
251
+ - Make sure to unselect `Skip special tokens`, otherwise it won't work
252
+ - This is just an attempt at approximating the Opus V1 prompt, it won't be perfect
253
+ - Character cards specifically rewritten for the built-in DreamGen preset:
254
+ - [Seraphina](configs/silly_tavern/cards/Seraphina.png) (based on the default Seraphina card)
255
+ - [Lara Lightland](configs/silly_tavern/cards/LaraLightland.png) (based on the card by Deffcolony)
256
+ - **LM Studio**
257
+ - [Config](configs/lmstudio/preset.json)
258
+ - Just like ChatML, just changed "assistant" to "text" role.
259
+ - **There's a bug** in LM Studio if you delete a message or click "Continue", [see here for details](https://discord.com/channels/1110598183144399058/1212665261128417280/1212665261128417280).
260
+ - **HuggingFace**
261
+ - [Chat template](tokenizer_config.json#L51)
262
+ - Just like ChatML, just changed "assistant" to "text" role.
263
+
264
+ ## Known Issues
265
+
266
+ - **34B repetition**:
267
+ - The 34B sometimes gets stuck repeating the same word, or synonyms. This seems to be a common problem across various Yi 34B fine-tunes.
268
+ - **GGUF**:
269
+ - The tokenization might be messed up. Some users reported that `<|im_start|>` and `<|im_end|>` are tokenized as multiple tokens. Also llama.cpp may not tokenize correctly (the Yi tokenizer is subtly different from the Llama 2 tokenizer).
270
+
271
+ ## License
272
+
273
+ - This model is intended for personal use only, other use is not permitted.