TheBloke commited on
Commit
bd563b5
1 Parent(s): c23052e

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +384 -0
README.md ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T
3
+ datasets:
4
+ - cerebras/SlimPajama-627B
5
+ - bigcode/starcoderdata
6
+ inference: false
7
+ language:
8
+ - en
9
+ license: apache-2.0
10
+ model_creator: Zhang Peiyuan
11
+ model_name: TinyLlama 1.1B Intermediate Step 715K 1.5T
12
+ model_type: tinyllama
13
+ prompt_template: '{prompt}
14
+
15
+ '
16
+ quantized_by: TheBloke
17
+ ---
18
+ <!-- markdownlint-disable MD041 -->
19
+
20
+ <!-- header start -->
21
+ <!-- 200823 -->
22
+ <div style="width: auto; margin-left: auto; margin-right: auto">
23
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
24
+ </div>
25
+ <div style="display: flex; justify-content: space-between; width: 100%;">
26
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
27
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
28
+ </div>
29
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
30
+ <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>
31
+ </div>
32
+ </div>
33
+ <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>
34
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
35
+ <!-- header end -->
36
+
37
+ # TinyLlama 1.1B Intermediate Step 715K 1.5T - AWQ
38
+ - Model creator: [Zhang Peiyuan](https://huggingface.co/PY007)
39
+ - Original model: [TinyLlama 1.1B Intermediate Step 715K 1.5T](https://huggingface.co/PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T)
40
+
41
+ <!-- description start -->
42
+ ## Description
43
+
44
+ This repo contains AWQ model files for [Zhang Peiyuan's TinyLlama 1.1B Intermediate Step 715K 1.5T](https://huggingface.co/PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T).
45
+
46
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
47
+
48
+
49
+ ### About AWQ
50
+
51
+ 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.
52
+
53
+ It is supported by:
54
+
55
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
56
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
57
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
58
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
59
+
60
+ <!-- description end -->
61
+ <!-- repositories-available start -->
62
+ ## Repositories available
63
+
64
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ)
65
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-GPTQ)
66
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-GGUF)
67
+ * [Zhang Peiyuan's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T)
68
+ <!-- repositories-available end -->
69
+
70
+ <!-- prompt-template start -->
71
+ ## Prompt template: None
72
+
73
+ ```
74
+ {prompt}
75
+
76
+ ```
77
+
78
+ <!-- prompt-template end -->
79
+
80
+
81
+ <!-- README_AWQ.md-provided-files start -->
82
+ ## Provided files, and AWQ parameters
83
+
84
+ For my first release of AWQ models, I am releasing 128g models only. I will consider adding 32g as well if there is interest, and once I have done perplexity and evaluation comparisons, but at this time 32g models are still not fully tested with AutoAWQ and vLLM.
85
+
86
+ Models are released as sharded safetensors files.
87
+
88
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
89
+ | ------ | ---- | -- | ----------- | ------- | ---- |
90
+ | [main](https://huggingface.co/TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 0.77 GB
91
+
92
+ <!-- README_AWQ.md-provided-files end -->
93
+
94
+ <!-- README_AWQ.md-text-generation-webui start -->
95
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
96
+
97
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
98
+
99
+ 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.
100
+
101
+ 1. Click the **Model tab**.
102
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ`.
103
+ 3. Click **Download**.
104
+ 4. The model will start downloading. Once it's finished it will say "Done".
105
+ 5. In the top left, click the refresh icon next to **Model**.
106
+ 6. In the **Model** dropdown, choose the model you just downloaded: `TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ`
107
+ 7. Select **Loader: AutoAWQ**.
108
+ 8. Click Load, and the model will load and is now ready for use.
109
+ 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.
110
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
111
+ <!-- README_AWQ.md-text-generation-webui end -->
112
+
113
+ <!-- README_AWQ.md-use-from-vllm start -->
114
+ ## Multi-user inference server: vLLM
115
+
116
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
117
+
118
+ - Please ensure you are using vLLM version 0.2 or later.
119
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
120
+
121
+ For example:
122
+
123
+ ```shell
124
+ python3 -m vllm.entrypoints.api_server --model TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ --quantization awq
125
+ ```
126
+
127
+ - When using vLLM from Python code, again set `quantization=awq`.
128
+
129
+ For example:
130
+
131
+ ```python
132
+ from vllm import LLM, SamplingParams
133
+
134
+ prompts = [
135
+ "Tell me about AI",
136
+ "Write a story about llamas",
137
+ "What is 291 - 150?",
138
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
139
+ ]
140
+ prompt_template=f'''{prompt}
141
+ '''
142
+
143
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
144
+
145
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
146
+
147
+ llm = LLM(model="TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ", quantization="awq", dtype="auto")
148
+
149
+ outputs = llm.generate(prompts, sampling_params)
150
+
151
+ # Print the outputs.
152
+ for output in outputs:
153
+ prompt = output.prompt
154
+ generated_text = output.outputs[0].text
155
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
156
+ ```
157
+ <!-- README_AWQ.md-use-from-vllm start -->
158
+
159
+ <!-- README_AWQ.md-use-from-tgi start -->
160
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
161
+
162
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
163
+
164
+ Example Docker parameters:
165
+
166
+ ```shell
167
+ --model-id TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
168
+ ```
169
+
170
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
171
+
172
+ ```shell
173
+ pip3 install huggingface-hub
174
+ ```
175
+
176
+ ```python
177
+ from huggingface_hub import InferenceClient
178
+
179
+ endpoint_url = "https://your-endpoint-url-here"
180
+
181
+ prompt = "Tell me about AI"
182
+ prompt_template=f'''{prompt}
183
+ '''
184
+
185
+ client = InferenceClient(endpoint_url)
186
+ response = client.text_generation(prompt,
187
+ max_new_tokens=128,
188
+ do_sample=True,
189
+ temperature=0.7,
190
+ top_p=0.95,
191
+ top_k=40,
192
+ repetition_penalty=1.1)
193
+
194
+ print(f"Model output: ", response)
195
+ ```
196
+ <!-- README_AWQ.md-use-from-tgi end -->
197
+
198
+ <!-- README_AWQ.md-use-from-python start -->
199
+ ## Inference from Python code using AutoAWQ
200
+
201
+ ### Install the AutoAWQ package
202
+
203
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
204
+
205
+ ```shell
206
+ pip3 install autoawq
207
+ ```
208
+
209
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
210
+
211
+ ```shell
212
+ pip3 uninstall -y autoawq
213
+ git clone https://github.com/casper-hansen/AutoAWQ
214
+ cd AutoAWQ
215
+ pip3 install .
216
+ ```
217
+
218
+ ### AutoAWQ example code
219
+
220
+ ```python
221
+ from awq import AutoAWQForCausalLM
222
+ from transformers import AutoTokenizer
223
+
224
+ model_name_or_path = "TheBloke/TinyLlama-1.1B-intermediate-step-715k-1.5T-AWQ"
225
+
226
+ # Load tokenizer
227
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
228
+ # Load model
229
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
230
+ trust_remote_code=False, safetensors=True)
231
+
232
+ prompt = "Tell me about AI"
233
+ prompt_template=f'''{prompt}
234
+ '''
235
+
236
+ print("*** Running model.generate:")
237
+
238
+ token_input = tokenizer(
239
+ prompt_template,
240
+ return_tensors='pt'
241
+ ).input_ids.cuda()
242
+
243
+ # Generate output
244
+ generation_output = model.generate(
245
+ token_input,
246
+ do_sample=True,
247
+ temperature=0.7,
248
+ top_p=0.95,
249
+ top_k=40,
250
+ max_new_tokens=512
251
+ )
252
+
253
+ # Get the tokens from the output, decode them, print them
254
+ token_output = generation_output[0]
255
+ text_output = tokenizer.decode(token_output)
256
+ print("LLM output: ", text_output)
257
+
258
+ """
259
+ # Inference should be possible with transformers pipeline as well in future
260
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
261
+ from transformers import pipeline
262
+
263
+ print("*** Pipeline:")
264
+ pipe = pipeline(
265
+ "text-generation",
266
+ model=model,
267
+ tokenizer=tokenizer,
268
+ max_new_tokens=512,
269
+ do_sample=True,
270
+ temperature=0.7,
271
+ top_p=0.95,
272
+ top_k=40,
273
+ repetition_penalty=1.1
274
+ )
275
+
276
+ print(pipe(prompt_template)[0]['generated_text'])
277
+ """
278
+ ```
279
+ <!-- README_AWQ.md-use-from-python end -->
280
+
281
+ <!-- README_AWQ.md-compatibility start -->
282
+ ## Compatibility
283
+
284
+ The files provided are tested to work with:
285
+
286
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
287
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
288
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
289
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
290
+
291
+ <!-- README_AWQ.md-compatibility end -->
292
+
293
+ <!-- footer start -->
294
+ <!-- 200823 -->
295
+ ## Discord
296
+
297
+ For further support, and discussions on these models and AI in general, join us at:
298
+
299
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
300
+
301
+ ## Thanks, and how to contribute
302
+
303
+ Thanks to the [chirper.ai](https://chirper.ai) team!
304
+
305
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
306
+
307
+ 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.
308
+
309
+ 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.
310
+
311
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
312
+
313
+ * Patreon: https://patreon.com/TheBlokeAI
314
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
315
+
316
+ **Special thanks to**: Aemon Algiz.
317
+
318
+ **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
319
+
320
+
321
+ Thank you to all my generous patrons and donaters!
322
+
323
+ And thank you again to a16z for their generous grant.
324
+
325
+ <!-- footer end -->
326
+
327
+ # Original model card: Zhang Peiyuan's TinyLlama 1.1B Intermediate Step 715K 1.5T
328
+
329
+ <div align="center">
330
+
331
+ # TinyLlama-1.1B
332
+ </div>
333
+
334
+ https://github.com/jzhang38/TinyLlama
335
+
336
+ The TinyLlama project aims to **pretrain** a **1.1B Llama model on 3 trillion tokens**. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.
337
+
338
+ <div align="center">
339
+ <img src="https://huggingface.co/PY007/TinyLlama-1.1B-intermediate-step-240k-503b/resolve/main/TinyLlama_logo.png" width="300"/>
340
+ </div>
341
+
342
+ We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.
343
+
344
+ #### This Model
345
+ This is an intermediate checkpoint with 715K steps and 1.49T tokens. **We suggest you not use this directly for inference.**
346
+
347
+
348
+ #### How to use
349
+ You will need the transformers>=4.31
350
+ Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
351
+ ```
352
+ from transformers import AutoTokenizer
353
+ import transformers
354
+ import torch
355
+ model = "PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T"
356
+ tokenizer = AutoTokenizer.from_pretrained(model)
357
+ pipeline = transformers.pipeline(
358
+ "text-generation",
359
+ model=model,
360
+ torch_dtype=torch.float16,
361
+ device_map="auto",
362
+ )
363
+
364
+ sequences = pipeline(
365
+ 'The TinyLlama project aims to pretrain a 1.1B Llama model on 3 trillion tokens. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.',
366
+ do_sample=True,
367
+ top_k=10,
368
+ num_return_sequences=1,
369
+ repetition_penalty=1.5,
370
+ eos_token_id=tokenizer.eos_token_id,
371
+ max_length=500,
372
+ )
373
+ for seq in sequences:
374
+ print(f"Result: {seq['generated_text']}")
375
+ ```
376
+
377
+ #### Eval
378
+ | Model | Pretrain Tokens | HellaSwag | Obqa | WinoGrande | ARC_c | ARC_e | boolq | piqa | avg |
379
+ |-------------------------------------------|-----------------|-----------|------|------------|-------|-------|-------|------|-----|
380
+ | Pythia-1.0B | 300B | 47.16 | 31.40| 53.43 | 27.05 | 48.99 | 60.83 | 69.21 | 48.30 |
381
+ | TinyLlama-1.1B-intermediate-step-50K-104b | 103B | 43.50 | 29.80| 53.28 | 24.32 | 44.91 | 59.66 | 67.30 | 46.11|
382
+ | TinyLlama-1.1B-intermediate-step-240k-503b| 503B | 49.56 |31.40 |55.80 |26.54 |48.32 |56.91 |69.42 | 48.28 |
383
+ | TinyLlama-1.1B-intermediate-step-480k-1007B | 1007B | 52.54 | 33.40 | 55.96 | 27.82 | 52.36 | 59.54 | 69.91 | 50.22 |
384
+ | TinyLlama-1.1B-intermediate-step-715k-1.5T | 1.49T | 53.68 | 35.20 | 58.33 | 29.18 | 51.89 | 59.08 | 71.65 | 51.29 |