Text Generation
Transformers
Safetensors
llama
conversational
Inference Endpoints
text-generation-inference
jondurbin commited on
Commit
2465acf
1 Parent(s): d2486ed

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +200 -0
README.md CHANGED
@@ -1,3 +1,203 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - ai2_arc
5
+ - jondurbin/airoboros-3.2
6
+ - codeparrot/apps
7
+ - facebook/belebele
8
+ - boolq
9
+ - jondurbin/cinematika-v0.1
10
+ - drop
11
+ - lmsys/lmsys-chat-1m
12
+ - TIGER-Lab/MathInstruct
13
+ - cais/mmlu
14
+ - Muennighoff/natural-instructions
15
+ - openbookqa
16
+ - piqa
17
+ - Vezora/Tested-22k-Python-Alpaca
18
+ - cakiki/rosetta-code
19
+ - Open-Orca/SlimOrca
20
+ - spider
21
+ - squad_v2
22
+ - migtissera/Synthia-v1.3
23
+ - datasets/winogrande
24
+ - nvidia/HelpSteer
25
+ - Intel/orca_dpo_pairs
26
+ - unalignment/toxic-dpo-v0.1
27
+ - jondurbin/truthy-dpo-v0.1
28
+ - allenai/ultrafeedback_binarized_cleaned
29
+ - Squish42/bluemoon-fandom-1-1-rp-cleaned
30
+ - LDJnr/Capybara
31
+ - JULIELab/EmoBank
32
+ - kingbri/PIPPA-shareGPT
33
  ---
34
+
35
+ # A bagel, with everything (except DPO)
36
+
37
+ ![bagel](bagel.png)
38
+
39
+ ## Overview
40
+
41
+ __*This model is basically unusable; sadly tinyllama is not a useful base model*__
42
+
43
+ An experimental fine-tune of [tinyllama](https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T) using [bagel](https://github.com/jondurbin/bagel)
44
+
45
+ This is the model after the SFT phase, before DPO has been applied.
46
+
47
+ Hardware kindly provided by [Massed Compute](https://massedcompute.com/?utm_source=huggingface&utm_creative_format=model_card&utm_content=creator_jon)
48
+
49
+ ### Data sources
50
+
51
+ *Yes, you will see benchmark names in the list, but this only uses the train splits, and a decontamination by cosine similarity is performed at the end as a sanity check*
52
+
53
+ - [ai2_arc](https://huggingface.co/datasets/ai2_arc)
54
+ - Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent.
55
+ - [airoboros](https://huggingface.co/datasets/unalignment/spicy-3.1)
56
+ - Variety of categories of synthetic instructions generated by gpt-4.
57
+ - [apps](https://huggingface.co/datasets/codeparrot/apps)
58
+ - Python coding dataset with 10k problems.
59
+ - [belebele](https://huggingface.co/datasets/facebook/belebele)
60
+ - Multi-lingual reading comprehension dataset.
61
+ - [bluemoon](https://huggingface.co/datasets/Squish42/bluemoon-fandom-1-1-rp-cleaned)
62
+ - Roleplay data scraped from Bluemoon, then cleaned and formatted as ShareGPT.
63
+ - [boolq](https://huggingface.co/datasets/boolq)
64
+ - Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)
65
+ - [capybara](https://huggingface.co/datasets/LDJnr/Capybara)
66
+ - Multi-turn dataset used to create the capybara models.
67
+ - [cinematika](https://huggingface.co/datasets/jondurbin/cinematika-v0.1) (instruction and plain text)
68
+ - RP-style data synthesized from movie scripts so the model isn't quite as boring as it otherwise would be.
69
+ - [drop](https://huggingface.co/datasets/drop)
70
+ - More reading comprehension.
71
+ - [emobank](https://github.com/JULIELab/EmoBank)
72
+ - Emotion annotations using the Valence-Arousal-Domninance scheme.
73
+ - [gutenberg](https://www.gutenberg.org/) (plain text)
74
+ - Books/plain text, again to make the model less boring, only a handful of examples supported by [chapterize](https://github.com/JonathanReeve/chapterize)
75
+ - [lmsys_chat_1m](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) (only gpt-4 items, also used for DPO)
76
+ - Chats collected by the lmsys chat arena, containing a wide variety of chats with various models.
77
+ - [mathinstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
78
+ - Composite dataset with a variety of math-related tasks and problem/question formats.
79
+ - [mmlu](https://huggingface.co/datasets/cais/mmlu)
80
+ - Massive Multitask Language Understanding - a wide variety of questions about various subject matters.
81
+ - [natural_instructions](https://huggingface.co/datasets/Muennighoff/natural-instructions)
82
+ - Millions of instructions from 1600+ task categories (sampled down substantially, stratified by task type)
83
+ - [openbookqa](https://huggingface.co/datasets/openbookqa)
84
+ - Question answering dataset.
85
+ - [pippa](https://huggingface.co/datasets/kingbri/PIPPA-shareGPT)
86
+ - Deduped version of [PIPPA](https://huggingface.co/datasets/PygmalionAI/PIPPA) in ShareGPT format.
87
+ - [piqa](https://huggingface.co/datasets/piqa)
88
+ - Phyiscal interaction question answering.
89
+ - [python_alpaca](https://huggingface.co/datasets/Vezora/Tested-22k-Python-Alpaca)
90
+ - Python instruction response pairs, validated as functional.
91
+ - [rosetta_code](https://huggingface.co/datasets/cakiki/rosetta-code)
92
+ - Code problems and solutions in a variety of programming languages taken from rosettacode.org.
93
+ - [slimorca](https://huggingface.co/datasets/Open-Orca/SlimOrca)
94
+ - Collection of ~500k gpt-4 verified chats from OpenOrca.
95
+ - [spider](https://huggingface.co/datasets/spider)
96
+ - SQL-targeted dataset.
97
+ - [squad_v2](https://huggingface.co/datasets/squad_v2)
98
+ - Contextual question answering (RAG).
99
+ - [synthia](https://huggingface.co/datasets/migtissera/Synthia-v1.3)
100
+ - GPT-4 generated data using advanced prompting from Migel Tissera.
101
+ - [winogrande](https://huggingface.co/datasets/winogrande)
102
+ - Fill in the blank style prompts.
103
+
104
+ Only the train splits were used (if a split was provided), and an additional pass of decontamination is performed using approximate nearest neighbor search (via faiss).
105
+
106
+ ## Prompt formatting
107
+
108
+ In sticking with the theme of the bagel, I didn't want to use a single prompt format, so I used 4 - vicuna, llama-2, alpaca, and chat-ml (sorta).
109
+ I also didn't want to randomly select a single prompt format for each item (hoping each instruction would generalize more when used in a variety of prompt formats), so each instruction is actually converted into every prompt format.
110
+
111
+ This means each epoch of our fine-tune is really basically 4 epochs. So, for the fine-tunes, I would recommend only doing 1 epoch (or 0.75 epochs). I am testing with a single epoch using a relatively low learning rate.
112
+
113
+ ### Alpaca (sort of)
114
+
115
+ ```
116
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
117
+
118
+ ### Instruction:
119
+ {system prompt, if provided}
120
+ {instruction}
121
+
122
+ ### Response:
123
+ ```
124
+
125
+ The main difference here is that because of the dataset formatting and variety of data sources, it would have been much to tedious to add an `### Input:` block, so the inputs are just in the instruction section.
126
+
127
+ ### Vicuna
128
+
129
+ ```
130
+ {system prompt, if provided, randomly defaulting to "A chat between a user and an unbiased, uncensored assistant."}
131
+ USER: {instruction}
132
+ ASSISTANT:
133
+ ```
134
+
135
+ ### ChatML (sort of)
136
+
137
+ I don't really understand the point of having special tokens for `<|im_start|>` and `<|im_end|>`, because in practice they just act as BOS and EOS tokens (but, please correct me if I'm wrong).
138
+
139
+ So, instead of:
140
+ ```text
141
+ {bos}<|im_start|>{role}
142
+ {text}
143
+ <|im_end|>{eos}
144
+ ```
145
+
146
+ I just changed it to:
147
+ ```text
148
+ {bos}{role}
149
+ {text}
150
+ {eos}
151
+ ```
152
+
153
+ If you *really* want to use `<|im_start|>` and `<|im_end|>`, just update your `tokenizer_config.json` to use `<|im_start|>` instead of `<s>` and `<|im_end|>` instead of `</s>` and when tokenizing. And if you still don't like what I've done to this chat-ml-ish format, feel free to cry into your pillow or fork the code and do a new fine-tune.
154
+
155
+ ### Llama-2 chat
156
+
157
+ ```
158
+ [INST] <<SYS>>
159
+ {system}
160
+ <</SYS>>
161
+
162
+ {instruction} [/INST]
163
+ ```
164
+
165
+ ### Default via chat template
166
+
167
+ The model's `tokenizer_config.json` includes the default chat template (llama-2), so you can simply use the `apply_chat_template` method to build the full prompt.
168
+
169
+ ```
170
+ import transformers
171
+ tokenizer = transformers.AutoTokenizer.from_pretrained('jondurbin/bagel-8x7b-v0.2')
172
+ chat = [
173
+ {"role": "system", "content": "You are Bob, a friendly AI assistant."},
174
+ {"role": "user", "content": "Hello, how are you?"},
175
+ {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
176
+ {"role": "user", "content": "I'd like to show off how chat templating works!"},
177
+ ]
178
+ print(tokenizer.apply_chat_template(chat, tokenize=False))
179
+ ```
180
+
181
+ ### Contribute
182
+
183
+ If you're interested in new functionality/datasets, take a look at [bagel repo](https://github.com/jondurbin/bagel) and either make a PR or open an issue with details.
184
+
185
+ To help me with the fine-tuning costs (which are extremely expensive for these large combined datasets):
186
+
187
+ - https://bmc.link/jondurbin
188
+ - ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
189
+ - BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
190
+
191
+ ### Licence and usage restrictions
192
+
193
+ The base model is tinyllama, which is licensed as apache-2.0 - no issues there.
194
+
195
+ The fine-tuning data, however, includes several datasets that have data generated at least in part by OpenAI's gpt-4.
196
+
197
+ I am not a lawyer, so I can't help determine if this is actually commercially viable, but some questions that often come up are:
198
+
199
+ - Does the OpenAI ToS apply only to the user who created the dataset initially, and not subsequent models?
200
+ - If the dataset was released under a permissive license, but actually includes OpenAI generated data, does that ToS supersede the license?
201
+ - Does the dataset fall completely under fair use anyways, since the model isn't really capable of reproducing the entire training set verbatim?
202
+
203
+ Use your best judgement and seek legal advice if you are concerned about the terms. In any case, by using this model, you agree to completely indemnify me.