TheBloke commited on
Commit
339d587
1 Parent(s): 5f9cf58

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +429 -0
README.md ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ajibawa-2023/Code-33B
3
+ datasets:
4
+ - ajibawa-2023/Code-74k-ShareGPT
5
+ inference: false
6
+ language:
7
+ - en
8
+ license: cc-by-nc-nd-4.0
9
+ model_creator: Feynman Innovations
10
+ model_name: Code 33B
11
+ model_type: llama
12
+ prompt_template: 'This is a conversation with your helpful AI assistant. AI assistant
13
+ can generate Code in various Programming Languages along with necessary explanation.
14
+
15
+
16
+ Context
17
+
18
+ You are a helpful AI assistant.
19
+
20
+
21
+ USER: {prompt}
22
+
23
+ ASSISTANT:
24
+
25
+ '
26
+ quantized_by: TheBloke
27
+ tags:
28
+ - code
29
+ ---
30
+ <!-- markdownlint-disable MD041 -->
31
+
32
+ <!-- header start -->
33
+ <!-- 200823 -->
34
+ <div style="width: auto; margin-left: auto; margin-right: auto">
35
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
36
+ </div>
37
+ <div style="display: flex; justify-content: space-between; width: 100%;">
38
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
39
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
40
+ </div>
41
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
42
+ <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>
43
+ </div>
44
+ </div>
45
+ <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>
46
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
47
+ <!-- header end -->
48
+
49
+ # Code 33B - AWQ
50
+ - Model creator: [Feynman Innovations](https://huggingface.co/ajibawa-2023)
51
+ - Original model: [Code 33B](https://huggingface.co/ajibawa-2023/Code-33B)
52
+
53
+ <!-- description start -->
54
+ ## Description
55
+
56
+ This repo contains AWQ model files for [Feynman Innovations's Code 33B](https://huggingface.co/ajibawa-2023/Code-33B).
57
+
58
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
59
+
60
+
61
+ ### About AWQ
62
+
63
+ 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.
64
+
65
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
66
+
67
+ It is supported by:
68
+
69
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
70
+ - [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
71
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
72
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
73
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
74
+
75
+ <!-- description end -->
76
+ <!-- repositories-available start -->
77
+ ## Repositories available
78
+
79
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Code-33B-AWQ)
80
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Code-33B-GPTQ)
81
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Code-33B-GGUF)
82
+ * [Feynman Innovations's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/ajibawa-2023/Code-33B)
83
+ <!-- repositories-available end -->
84
+
85
+ <!-- prompt-template start -->
86
+ ## Prompt template: Ajibawa-Code
87
+
88
+ ```
89
+ This is a conversation with your helpful AI assistant. AI assistant can generate Code in various Programming Languages along with necessary explanation.
90
+
91
+ Context
92
+ You are a helpful AI assistant.
93
+
94
+ USER: {prompt}
95
+ ASSISTANT:
96
+
97
+ ```
98
+
99
+ <!-- prompt-template end -->
100
+
101
+
102
+ <!-- README_AWQ.md-provided-files start -->
103
+ ## Provided files, and AWQ parameters
104
+
105
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
106
+
107
+ Models are released as sharded safetensors files.
108
+
109
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
110
+ | ------ | ---- | -- | ----------- | ------- | ---- |
111
+ | [main](https://huggingface.co/TheBloke/Code-33B-AWQ/tree/main) | 4 | 128 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1/viewer/) | 2048 | 17.53 GB
112
+
113
+ <!-- README_AWQ.md-provided-files end -->
114
+
115
+ <!-- README_AWQ.md-text-generation-webui start -->
116
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
117
+
118
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
119
+
120
+ 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.
121
+
122
+ 1. Click the **Model tab**.
123
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Code-33B-AWQ`.
124
+ 3. Click **Download**.
125
+ 4. The model will start downloading. Once it's finished it will say "Done".
126
+ 5. In the top left, click the refresh icon next to **Model**.
127
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Code-33B-AWQ`
128
+ 7. Select **Loader: AutoAWQ**.
129
+ 8. Click Load, and the model will load and is now ready for use.
130
+ 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.
131
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
132
+ <!-- README_AWQ.md-text-generation-webui end -->
133
+
134
+ <!-- README_AWQ.md-use-from-vllm start -->
135
+ ## Multi-user inference server: vLLM
136
+
137
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
138
+
139
+ - Please ensure you are using vLLM version 0.2 or later.
140
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
141
+
142
+ For example:
143
+
144
+ ```shell
145
+ python3 -m vllm.entrypoints.api_server --model TheBloke/Code-33B-AWQ --quantization awq --dtype auto
146
+ ```
147
+
148
+ - When using vLLM from Python code, again set `quantization=awq`.
149
+
150
+ For example:
151
+
152
+ ```python
153
+ from vllm import LLM, SamplingParams
154
+
155
+ prompts = [
156
+ "Tell me about AI",
157
+ "Write a story about llamas",
158
+ "What is 291 - 150?",
159
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
160
+ ]
161
+ prompt_template=f'''This is a conversation with your helpful AI assistant. AI assistant can generate Code in various Programming Languages along with necessary explanation.
162
+
163
+ Context
164
+ You are a helpful AI assistant.
165
+
166
+ USER: {prompt}
167
+ ASSISTANT:
168
+ '''
169
+
170
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
171
+
172
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
173
+
174
+ llm = LLM(model="TheBloke/Code-33B-AWQ", quantization="awq", dtype="auto")
175
+
176
+ outputs = llm.generate(prompts, sampling_params)
177
+
178
+ # Print the outputs.
179
+ for output in outputs:
180
+ prompt = output.prompt
181
+ generated_text = output.outputs[0].text
182
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
183
+ ```
184
+ <!-- README_AWQ.md-use-from-vllm start -->
185
+
186
+ <!-- README_AWQ.md-use-from-tgi start -->
187
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
188
+
189
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
190
+
191
+ Example Docker parameters:
192
+
193
+ ```shell
194
+ --model-id TheBloke/Code-33B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
195
+ ```
196
+
197
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
198
+
199
+ ```shell
200
+ pip3 install huggingface-hub
201
+ ```
202
+
203
+ ```python
204
+ from huggingface_hub import InferenceClient
205
+
206
+ endpoint_url = "https://your-endpoint-url-here"
207
+
208
+ prompt = "Tell me about AI"
209
+ prompt_template=f'''This is a conversation with your helpful AI assistant. AI assistant can generate Code in various Programming Languages along with necessary explanation.
210
+
211
+ Context
212
+ You are a helpful AI assistant.
213
+
214
+ USER: {prompt}
215
+ ASSISTANT:
216
+ '''
217
+
218
+ client = InferenceClient(endpoint_url)
219
+ response = client.text_generation(prompt,
220
+ max_new_tokens=128,
221
+ do_sample=True,
222
+ temperature=0.7,
223
+ top_p=0.95,
224
+ top_k=40,
225
+ repetition_penalty=1.1)
226
+
227
+ print(f"Model output: ", response)
228
+ ```
229
+ <!-- README_AWQ.md-use-from-tgi end -->
230
+
231
+ <!-- README_AWQ.md-use-from-python start -->
232
+ ## Inference from Python code using Transformers
233
+
234
+ ### Install the necessary packages
235
+
236
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
237
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
238
+
239
+ ```shell
240
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
241
+ ```
242
+
243
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
244
+
245
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
246
+
247
+ ```shell
248
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
249
+ ```
250
+
251
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
252
+
253
+ ```shell
254
+ pip3 uninstall -y autoawq
255
+ git clone https://github.com/casper-hansen/AutoAWQ
256
+ cd AutoAWQ
257
+ pip3 install .
258
+ ```
259
+
260
+ ### Transformers example code (requires Transformers 4.35.0 and later)
261
+
262
+ ```python
263
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
264
+
265
+ model_name_or_path = "TheBloke/Code-33B-AWQ"
266
+
267
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
268
+ model = AutoModelForCausalLM.from_pretrained(
269
+ model_name_or_path,
270
+ low_cpu_mem_usage=True,
271
+ device_map="cuda:0"
272
+ )
273
+
274
+ # Using the text streamer to stream output one token at a time
275
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
276
+
277
+ prompt = "Tell me about AI"
278
+ prompt_template=f'''This is a conversation with your helpful AI assistant. AI assistant can generate Code in various Programming Languages along with necessary explanation.
279
+
280
+ Context
281
+ You are a helpful AI assistant.
282
+
283
+ USER: {prompt}
284
+ ASSISTANT:
285
+ '''
286
+
287
+ # Convert prompt to tokens
288
+ tokens = tokenizer(
289
+ prompt_template,
290
+ return_tensors='pt'
291
+ ).input_ids.cuda()
292
+
293
+ generation_params = {
294
+ "do_sample": True,
295
+ "temperature": 0.7,
296
+ "top_p": 0.95,
297
+ "top_k": 40,
298
+ "max_new_tokens": 512,
299
+ "repetition_penalty": 1.1
300
+ }
301
+
302
+ # Generate streamed output, visible one token at a time
303
+ generation_output = model.generate(
304
+ tokens,
305
+ streamer=streamer,
306
+ **generation_params
307
+ )
308
+
309
+ # Generation without a streamer, which will include the prompt in the output
310
+ generation_output = model.generate(
311
+ tokens,
312
+ **generation_params
313
+ )
314
+
315
+ # Get the tokens from the output, decode them, print them
316
+ token_output = generation_output[0]
317
+ text_output = tokenizer.decode(token_output)
318
+ print("model.generate output: ", text_output)
319
+
320
+ # Inference is also possible via Transformers' pipeline
321
+ from transformers import pipeline
322
+
323
+ pipe = pipeline(
324
+ "text-generation",
325
+ model=model,
326
+ tokenizer=tokenizer,
327
+ **generation_params
328
+ )
329
+
330
+ pipe_output = pipe(prompt_template)[0]['generated_text']
331
+ print("pipeline output: ", pipe_output)
332
+
333
+ ```
334
+ <!-- README_AWQ.md-use-from-python end -->
335
+
336
+ <!-- README_AWQ.md-compatibility start -->
337
+ ## Compatibility
338
+
339
+ The files provided are tested to work with:
340
+
341
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
342
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
343
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
344
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
345
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
346
+
347
+ <!-- README_AWQ.md-compatibility end -->
348
+
349
+ <!-- footer start -->
350
+ <!-- 200823 -->
351
+ ## Discord
352
+
353
+ For further support, and discussions on these models and AI in general, join us at:
354
+
355
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
356
+
357
+ ## Thanks, and how to contribute
358
+
359
+ Thanks to the [chirper.ai](https://chirper.ai) team!
360
+
361
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
362
+
363
+ 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.
364
+
365
+ 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.
366
+
367
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
368
+
369
+ * Patreon: https://patreon.com/TheBlokeAI
370
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
371
+
372
+ **Special thanks to**: Aemon Algiz.
373
+
374
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
375
+
376
+
377
+ Thank you to all my generous patrons and donaters!
378
+
379
+ And thank you again to a16z for their generous grant.
380
+
381
+ <!-- footer end -->
382
+
383
+ # Original model card: Feynman Innovations's Code 33B
384
+
385
+
386
+ **Code-33B**
387
+
388
+ Large Language Models (LLMs) are good with code generations. Sometimes they do make mistakes in code generation. How about if they can give detailed explanation along with the code.
389
+ This is what I have tried over here. The base Llama-1 model was used for training purpose. It is trained on around 74000 set of codes. Each set having 2 conversations.
390
+ Along with Python, Java, JavaScript, GO, C++, Rust etc. code with detailed explanation is used for training purpose. It is built upon using my existing Dataset [Python-Code-23k-ShareGPT](https://huggingface.co/datasets/ajibawa-2023/Python-Code-23k-ShareGPT).
391
+ This conversation is in Vicuna/ShareGPT format. Each set, along with code, has detailed explanation.
392
+
393
+ I have released the new data [Code-74k-ShareGPT](https://huggingface.co/datasets/ajibawa-2023/Code-74k-ShareGPT) on which this Model is trained.
394
+
395
+ **Training:**
396
+
397
+ Entire dataset was trained on 4 x A100 80GB. For 3 epoch, training took 6 days & 5 hours. DeepSpeed codebase was used for training purpose. This was trained on Llama-1 by Meta.
398
+
399
+
400
+ This is a full fine tuned model. Links for quantized models will be updated soon.
401
+
402
+
403
+ **GPTQ GGUF & AWQ**
404
+
405
+ GPTQ: TBA
406
+
407
+ GGUF: [Link](https://huggingface.co/TheBloke/Code-33B-GGUF)
408
+
409
+ AWQ: TBA
410
+
411
+
412
+
413
+
414
+ **Example Prompt:**
415
+ ```
416
+ This is a conversation with your helpful AI assistant. AI assistant can generate Code in various Programming Languages along with necessary explanation.
417
+
418
+ Context
419
+ You are a helpful AI assistant.
420
+
421
+ USER: <prompt>
422
+ ASSISTANT:
423
+ ```
424
+
425
+ You can modify above Prompt as per your requirement. I have used ShareGPT/Vicuna format v1.1 .
426
+
427
+ I want to say special Thanks to the Open Source community for helping & guiding me to better understand the AI/Model development.
428
+
429
+ Thank you for your love & support.