Text Generation
Transformers
Safetensors
English
llama
text-generation-inference
4-bit precision
awq
TheBloke commited on
Commit
9f8a5fb
1 Parent(s): ba1c8ad

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +486 -0
README.md ADDED
@@ -0,0 +1,486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: allenai/tulu-2-dpo-13b
3
+ datasets:
4
+ - HuggingFaceH4/ultrafeedback_binarized
5
+ - allenai/tulu-v2-sft-mixture
6
+ inference: false
7
+ language:
8
+ - en
9
+ license: other
10
+ model-index:
11
+ - name: tulu-2-dpo-13b
12
+ results: []
13
+ model_creator: Allen Institute for AI
14
+ model_name: Tulu 2 DPO 13B
15
+ model_type: llama
16
+ prompt_template: '<|user|>
17
+
18
+ {prompt}
19
+
20
+ <|assistant|>
21
+
22
+ '
23
+ quantized_by: TheBloke
24
+ ---
25
+ <!-- markdownlint-disable MD041 -->
26
+
27
+ <!-- header start -->
28
+ <!-- 200823 -->
29
+ <div style="width: auto; margin-left: auto; margin-right: auto">
30
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
31
+ </div>
32
+ <div style="display: flex; justify-content: space-between; width: 100%;">
33
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
34
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
35
+ </div>
36
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
37
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
38
+ </div>
39
+ </div>
40
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
41
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
42
+ <!-- header end -->
43
+
44
+ # Tulu 2 DPO 13B - AWQ
45
+ - Model creator: [Allen Institute for AI](https://huggingface.co/allenai)
46
+ - Original model: [Tulu 2 DPO 13B](https://huggingface.co/allenai/tulu-2-dpo-13b)
47
+
48
+ <!-- description start -->
49
+ ## Description
50
+
51
+ This repo contains AWQ model files for [Allen Institute for AI's Tulu 2 DPO 13B](https://huggingface.co/allenai/tulu-2-dpo-13b).
52
+
53
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
54
+
55
+
56
+ ### About AWQ
57
+
58
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
59
+
60
+ It is supported by:
61
+
62
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
63
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
64
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
65
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
66
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
67
+
68
+ <!-- description end -->
69
+ <!-- repositories-available start -->
70
+ ## Repositories available
71
+
72
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/tulu-2-dpo-13B-AWQ)
73
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/tulu-2-dpo-13B-GPTQ)
74
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/tulu-2-dpo-13B-GGUF)
75
+ * [Allen Institute for AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/allenai/tulu-2-dpo-13b)
76
+ <!-- repositories-available end -->
77
+
78
+ <!-- prompt-template start -->
79
+ ## Prompt template: Tulu
80
+
81
+ ```
82
+ <|user|>
83
+ {prompt}
84
+ <|assistant|>
85
+
86
+ ```
87
+
88
+ <!-- prompt-template end -->
89
+
90
+
91
+ <!-- README_AWQ.md-provided-files start -->
92
+ ## Provided files, and AWQ parameters
93
+
94
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
95
+
96
+ Models are released as sharded safetensors files.
97
+
98
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
99
+ | ------ | ---- | -- | ----------- | ------- | ---- |
100
+ | [main](https://huggingface.co/TheBloke/tulu-2-dpo-13B-AWQ/tree/main) | 4 | 128 | [VMWare Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 7.25 GB
101
+
102
+ <!-- README_AWQ.md-provided-files end -->
103
+
104
+ <!-- README_AWQ.md-text-generation-webui start -->
105
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
106
+
107
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
108
+
109
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
110
+
111
+ 1. Click the **Model tab**.
112
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/tulu-2-dpo-13B-AWQ`.
113
+ 3. Click **Download**.
114
+ 4. The model will start downloading. Once it's finished it will say "Done".
115
+ 5. In the top left, click the refresh icon next to **Model**.
116
+ 6. In the **Model** dropdown, choose the model you just downloaded: `tulu-2-dpo-13B-AWQ`
117
+ 7. Select **Loader: AutoAWQ**.
118
+ 8. Click Load, and the model will load and is now ready for use.
119
+ 9. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
120
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
121
+ <!-- README_AWQ.md-text-generation-webui end -->
122
+
123
+ <!-- README_AWQ.md-use-from-vllm start -->
124
+ ## Multi-user inference server: vLLM
125
+
126
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
127
+
128
+ - Please ensure you are using vLLM version 0.2 or later.
129
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
130
+
131
+ For example:
132
+
133
+ ```shell
134
+ python3 -m vllm.entrypoints.api_server --model TheBloke/tulu-2-dpo-13B-AWQ --quantization awq --dtype auto
135
+ ```
136
+
137
+ - When using vLLM from Python code, again set `quantization=awq`.
138
+
139
+ For example:
140
+
141
+ ```python
142
+ from vllm import LLM, SamplingParams
143
+
144
+ prompts = [
145
+ "Tell me about AI",
146
+ "Write a story about llamas",
147
+ "What is 291 - 150?",
148
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
149
+ ]
150
+ prompt_template=f'''<|user|>
151
+ {prompt}
152
+ <|assistant|>
153
+ '''
154
+
155
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
156
+
157
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
158
+
159
+ llm = LLM(model="TheBloke/tulu-2-dpo-13B-AWQ", quantization="awq", dtype="auto")
160
+
161
+ outputs = llm.generate(prompts, sampling_params)
162
+
163
+ # Print the outputs.
164
+ for output in outputs:
165
+ prompt = output.prompt
166
+ generated_text = output.outputs[0].text
167
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
168
+ ```
169
+ <!-- README_AWQ.md-use-from-vllm start -->
170
+
171
+ <!-- README_AWQ.md-use-from-tgi start -->
172
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
173
+
174
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
175
+
176
+ Example Docker parameters:
177
+
178
+ ```shell
179
+ --model-id TheBloke/tulu-2-dpo-13B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
180
+ ```
181
+
182
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
183
+
184
+ ```shell
185
+ pip3 install huggingface-hub
186
+ ```
187
+
188
+ ```python
189
+ from huggingface_hub import InferenceClient
190
+
191
+ endpoint_url = "https://your-endpoint-url-here"
192
+
193
+ prompt = "Tell me about AI"
194
+ prompt_template=f'''<|user|>
195
+ {prompt}
196
+ <|assistant|>
197
+ '''
198
+
199
+ client = InferenceClient(endpoint_url)
200
+ response = client.text_generation(prompt,
201
+ max_new_tokens=128,
202
+ do_sample=True,
203
+ temperature=0.7,
204
+ top_p=0.95,
205
+ top_k=40,
206
+ repetition_penalty=1.1)
207
+
208
+ print(f"Model output: ", response)
209
+ ```
210
+ <!-- README_AWQ.md-use-from-tgi end -->
211
+
212
+ <!-- README_AWQ.md-use-from-python start -->
213
+ ## Inference from Python code using Transformers
214
+
215
+ ### Install the necessary packages
216
+
217
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
218
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
219
+
220
+ ```shell
221
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
222
+ ```
223
+
224
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
225
+
226
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
227
+
228
+ ```shell
229
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
230
+ ```
231
+
232
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
233
+
234
+ ```shell
235
+ pip3 uninstall -y autoawq
236
+ git clone https://github.com/casper-hansen/AutoAWQ
237
+ cd AutoAWQ
238
+ pip3 install .
239
+ ```
240
+
241
+ ### Transformers example code (requires Transformers 4.35.0 and later)
242
+
243
+ ```python
244
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
245
+
246
+ model_name_or_path = "TheBloke/tulu-2-dpo-13B-AWQ"
247
+
248
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
249
+ model = AutoModelForCausalLM.from_pretrained(
250
+ model_name_or_path,
251
+ low_cpu_mem_usage=True,
252
+ device_map="cuda:0"
253
+ )
254
+
255
+ # Using the text streamer to stream output one token at a time
256
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
257
+
258
+ prompt = "Tell me about AI"
259
+ prompt_template=f'''<|user|>
260
+ {prompt}
261
+ <|assistant|>
262
+ '''
263
+
264
+ # Convert prompt to tokens
265
+ tokens = tokenizer(
266
+ prompt_template,
267
+ return_tensors='pt'
268
+ ).input_ids.cuda()
269
+
270
+ generation_params = {
271
+ "do_sample": True,
272
+ "temperature": 0.7,
273
+ "top_p": 0.95,
274
+ "top_k": 40,
275
+ "max_new_tokens": 512,
276
+ "repetition_penalty": 1.1
277
+ }
278
+
279
+ # Generate streamed output, visible one token at a time
280
+ generation_output = model.generate(
281
+ tokens,
282
+ streamer=streamer,
283
+ **generation_params
284
+ )
285
+
286
+ # Generation without a streamer, which will include the prompt in the output
287
+ generation_output = model.generate(
288
+ tokens,
289
+ **generation_params
290
+ )
291
+
292
+ # Get the tokens from the output, decode them, print them
293
+ token_output = generation_output[0]
294
+ text_output = tokenizer.decode(token_output)
295
+ print("model.generate output: ", text_output)
296
+
297
+ # Inference is also possible via Transformers' pipeline
298
+ from transformers import pipeline
299
+
300
+ pipe = pipeline(
301
+ "text-generation",
302
+ model=model,
303
+ tokenizer=tokenizer,
304
+ **generation_params
305
+ )
306
+
307
+ pipe_output = pipe(prompt_template)[0]['generated_text']
308
+ print("pipeline output: ", pipe_output)
309
+
310
+ ```
311
+ <!-- README_AWQ.md-use-from-python end -->
312
+
313
+ <!-- README_AWQ.md-compatibility start -->
314
+ ## Compatibility
315
+
316
+ The files provided are tested to work with:
317
+
318
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
319
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
320
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
321
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
322
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
323
+
324
+ <!-- README_AWQ.md-compatibility end -->
325
+
326
+ <!-- footer start -->
327
+ <!-- 200823 -->
328
+ ## Discord
329
+
330
+ For further support, and discussions on these models and AI in general, join us at:
331
+
332
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
333
+
334
+ ## Thanks, and how to contribute
335
+
336
+ Thanks to the [chirper.ai](https://chirper.ai) team!
337
+
338
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
339
+
340
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
341
+
342
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
343
+
344
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
345
+
346
+ * Patreon: https://patreon.com/TheBlokeAI
347
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
348
+
349
+ **Special thanks to**: Aemon Algiz.
350
+
351
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
352
+
353
+
354
+ Thank you to all my generous patrons and donaters!
355
+
356
+ And thank you again to a16z for their generous grant.
357
+
358
+ <!-- footer end -->
359
+
360
+ # Original model card: Allen Institute for AI's Tulu 2 DPO 13B
361
+
362
+
363
+
364
+ <img src="https://huggingface.co/datasets/allenai/blog-images/resolve/main/tulu-v2/Tulu%20V2%20banner.png" alt="TuluV2 banner" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
365
+
366
+
367
+ # Model Card for Tulu V2 DPO 13B
368
+
369
+ Tulu is a series of language models that are trained to act as helpful assistants.
370
+ Tulu V2 DPO 13B is a fine-tuned version of Llama 2 that was trained on on a mix of publicly available, synthetic and human datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290).
371
+ This model is a strong alternative to Llama 2 13b Chat.
372
+
373
+ For more details, read the paper: [Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2
374
+ ](https://arxiv.org/abs/2311.10702).
375
+
376
+
377
+ ## Model description
378
+
379
+ - **Model type:** A model belonging to a suite of instruction and RLHF tuned chat models on a mix of publicly available, synthetic and human-created datasets.
380
+ - **Language(s) (NLP):** Primarily English
381
+ - **License:** [AI2 ImpACT](https://allenai.org/impact-license) Low-risk license.
382
+ - **Finetuned from model:** [meta-llama/Llama-2-13b-hf](https://huggingface.co/meta-llama/Llama-2-13b-hf)
383
+
384
+ ### Model Sources
385
+
386
+ - **Repository:** https://github.com/allenai/https://github.com/allenai/open-instruct
387
+ - **DPO Recipe:** The DPO recipe is from the [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) model
388
+ - **Model Family:** Other models and the dataset are found in the [Tulu V2 collection](https://huggingface.co/collections/allenai/tulu-v2-suite-6551b56e743e6349aab45101).
389
+
390
+ ## Performance
391
+
392
+ | Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
393
+ |-------------|-----|----|---------------|--------------|
394
+ | **Tulu-v2-7b** 🐪 | **7B** | **SFT** | **6.30** | **73.9** |
395
+ | **Tulu-v2-dpo-7b** 🐪 | **7B** | **DPO** | **6.29** | **85.1** |
396
+ | **Tulu-v2-13b** 🐪 | **13B** | **SFT** | **6.70** | **78.9** |
397
+ | **Tulu-v2-dpo-13b** 🐪 | **13B** | **DPO** | **7.00** | **89.5** |
398
+ | **Tulu-v2-70b** 🐪 | **70B** | **SFT** | **7.49** | **86.6** |
399
+ | **Tulu-v2-dpo-70b** 🐪 | **70B** | **DPO** | **7.89** | **95.1** |
400
+
401
+ ## Input Format
402
+
403
+ The model is trained to use the following format (note the newlines):
404
+ ```
405
+ <|user|>
406
+ Your message here!
407
+ <|assistant|>
408
+ ```
409
+
410
+ For best results, format all inputs in this manner. **Make sure to include a newline after `<|assistant|>`, this can affect generation quality quite a bit.**
411
+
412
+
413
+ ## Intended uses & limitations
414
+
415
+ The model was initially fine-tuned on a filtered and preprocessed of the [Tulu V2 mix dataset](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture), which contains a diverse range of human created instructions and synthetic dialogues generated primarily by other LLMs.
416
+ We then further aligned the model with a [Jax DPO trainer](https://github.com/hamishivi/EasyLM/blob/main/EasyLM/models/llama/llama_train_dpo.py) built on [EasyLM](https://github.com/young-geng/EasyLM) on the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) dataset, which contains 64k prompts and model completions that are ranked by GPT-4.
417
+
418
+
419
+ <!-- You can find the datasets used for training Tulu V2 [here]()
420
+
421
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
422
+
423
+ ```python
424
+ # Install transformers from source - only needed for versions <= v4.34
425
+ # pip install git+https://github.com/huggingface/transformers.git
426
+ # pip install accelerate
427
+
428
+ import torch
429
+ from transformers import pipeline
430
+
431
+ pipe = pipeline("text-generation", model="HuggingFaceH4/tulu-2-dpo-70b", torch_dtype=torch.bfloat16, device_map="auto")
432
+
433
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
434
+ messages = [
435
+ {
436
+ "role": "system",
437
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
438
+ },
439
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
440
+ ]
441
+ prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
442
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
443
+ print(outputs[0]["generated_text"])
444
+ # <|system|>
445
+ # You are a friendly chatbot who always responds in the style of a pirate.</s>
446
+ # <|user|>
447
+ # How many helicopters can a human eat in one sitting?</s>
448
+ # <|assistant|>
449
+ # Ah, me hearty matey! But yer question be a puzzler! A human cannot eat a helicopter in one sitting, as helicopters are not edible. They be made of metal, plastic, and other materials, not food!
450
+ ```-->
451
+
452
+ ## Bias, Risks, and Limitations
453
+
454
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
455
+
456
+ The Tulu models have not been aligned to generate safe completions within the RLHF phase or deployed with in-the-loop filtering of responses like ChatGPT, so the model can produce problematic outputs (especially when prompted to do so).
457
+ It is also unknown what the size and composition of the corpus was used to train the base Llama 2 models, however it is likely to have included a mix of Web data and technical sources like books and code. See the [Falcon 180B model card](https://huggingface.co/tiiuae/falcon-180B#training-data) for an example of this.
458
+
459
+
460
+ ### Training hyperparameters
461
+
462
+ The following hyperparameters were used during DPO training:
463
+ - learning_rate: 5e-07
464
+ - total_train_batch_size: 32
465
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
466
+ - lr_scheduler_type: linear
467
+ - lr_scheduler_warmup_ratio: 0.1
468
+ - num_epochs: 3.0
469
+
470
+
471
+ ## Citation
472
+
473
+ If you find Tulu 2 is useful in your work, please cite it with:
474
+
475
+ ```
476
+ @misc{ivison2023camels,
477
+ title={Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2},
478
+ author={Hamish Ivison and Yizhong Wang and Valentina Pyatkin and Nathan Lambert and Matthew Peters and Pradeep Dasigi and Joel Jang and David Wadden and Noah A. Smith and Iz Beltagy and Hannaneh Hajishirzi},
479
+ year={2023},
480
+ eprint={2311.10702},
481
+ archivePrefix={arXiv},
482
+ primaryClass={cs.CL}
483
+ }
484
+ ```
485
+
486
+ *Model card adapted from [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta/blob/main/README.md)*