TheBloke commited on
Commit
06a1a12
1 Parent(s): e6338b7

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +335 -0
README.md ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ngoantech/Llama-2-7b-vietnamese-20k
3
+ inference: false
4
+ license: llama2
5
+ model_creator: Pham Van Ngoan
6
+ model_name: Llama 2 7B Vietnamese 20K
7
+ model_type: llama
8
+ prompt_template: '{prompt}
9
+
10
+ '
11
+ quantized_by: TheBloke
12
+ tags:
13
+ - text-generation
14
+ - llama-2
15
+ - llama-2-7B
16
+ - llama2-vietnamese
17
+ - vietnamese
18
+ ---
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
+ # Llama 2 7B Vietnamese 20K - AWQ
38
+ - Model creator: [Pham Van Ngoan](https://huggingface.co/ngoantech)
39
+ - Original model: [Llama 2 7B Vietnamese 20K](https://huggingface.co/ngoantech/Llama-2-7b-vietnamese-20k)
40
+
41
+ <!-- description start -->
42
+ ## Description
43
+
44
+ This repo contains AWQ model files for [Pham Van Ngoan's Llama 2 7B Vietnamese 20K](https://huggingface.co/ngoantech/Llama-2-7b-vietnamese-20k).
45
+
46
+
47
+ ### About AWQ
48
+
49
+ 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.
50
+
51
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
52
+
53
+ As of September 25th 2023, preliminary Llama-only AWQ support has also been added to [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference).
54
+
55
+ Note that, at the time of writing, overall throughput is still lower than running vLLM or TGI with unquantised models, however using AWQ enables using much smaller GPUs which can lead to easier deployment and overall cost savings. For example, a 70B model can be run on 1 x 48GB GPU instead of 2 x 80GB.
56
+ <!-- description end -->
57
+ <!-- repositories-available start -->
58
+ ## Repositories available
59
+
60
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Llama-2-7B-vietnamese-20k-AWQ)
61
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Llama-2-7B-vietnamese-20k-GPTQ)
62
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Llama-2-7B-vietnamese-20k-GGUF)
63
+ * [Pham Van Ngoan's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/ngoantech/Llama-2-7b-vietnamese-20k)
64
+ <!-- repositories-available end -->
65
+
66
+ <!-- prompt-template start -->
67
+ ## Prompt template: Unknown
68
+
69
+ ```
70
+ {prompt}
71
+
72
+ ```
73
+
74
+ <!-- prompt-template end -->
75
+
76
+
77
+ <!-- README_AWQ.md-provided-files start -->
78
+ ## Provided files, and AWQ parameters
79
+
80
+ 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.
81
+
82
+ Models are released as sharded safetensors files.
83
+
84
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
85
+ | ------ | ---- | -- | ----------- | ------- | ---- |
86
+ | [main](https://huggingface.co/TheBloke/Llama-2-7B-vietnamese-20k-AWQ/tree/main) | 4 | 128 | vietnamese | 4096 | 3.89 GB
87
+
88
+ <!-- README_AWQ.md-provided-files end -->
89
+
90
+ <!-- README_AWQ.md-use-from-vllm start -->
91
+ ## Serving this model from vLLM
92
+
93
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
94
+
95
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
96
+
97
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
98
+
99
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
100
+
101
+ ```shell
102
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Llama-2-7B-vietnamese-20k-AWQ --quantization awq --dtype half
103
+ ```
104
+
105
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
106
+
107
+ ```python
108
+ from vllm import LLM, SamplingParams
109
+
110
+ prompts = [
111
+ "Hello, my name is",
112
+ "The president of the United States is",
113
+ "The capital of France is",
114
+ "The future of AI is",
115
+ ]
116
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
117
+
118
+ llm = LLM(model="TheBloke/Llama-2-7B-vietnamese-20k-AWQ", quantization="awq", dtype="half")
119
+
120
+ outputs = llm.generate(prompts, sampling_params)
121
+
122
+ # Print the outputs.
123
+ for output in outputs:
124
+ prompt = output.prompt
125
+ generated_text = output.outputs[0].text
126
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
127
+ ```
128
+ <!-- README_AWQ.md-use-from-vllm start -->
129
+
130
+ <!-- README_AWQ.md-use-from-tgi start -->
131
+ ## Serving this model from Text Generation Inference (TGI)
132
+
133
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
134
+
135
+ Example Docker parameters:
136
+
137
+ ```shell
138
+ --model-id TheBloke/Llama-2-7B-vietnamese-20k-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
139
+ ```
140
+
141
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
142
+
143
+ ```shell
144
+ pip3 install huggingface-hub
145
+ ```
146
+
147
+ ```python
148
+ from huggingface_hub import InferenceClient
149
+
150
+ endpoint_url = "https://your-endpoint-url-here"
151
+
152
+ prompt = "Tell me about AI"
153
+ prompt_template=f'''{prompt}
154
+
155
+ '''
156
+
157
+ client = InferenceClient(endpoint_url)
158
+ response = client.text_generation(prompt,
159
+ max_new_tokens=128,
160
+ do_sample=True,
161
+ temperature=0.7,
162
+ top_p=0.95,
163
+ top_k=40,
164
+ repetition_penalty=1.1)
165
+
166
+ print(f"Model output: {response}")
167
+ ```
168
+ <!-- README_AWQ.md-use-from-tgi end -->
169
+
170
+ <!-- README_AWQ.md-use-from-python start -->
171
+ ## How to use this AWQ model from Python code
172
+
173
+ ### Install the necessary packages
174
+
175
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
176
+
177
+ ```shell
178
+ pip3 install autoawq
179
+ ```
180
+
181
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
182
+
183
+ ```shell
184
+ pip3 uninstall -y autoawq
185
+ git clone https://github.com/casper-hansen/AutoAWQ
186
+ cd AutoAWQ
187
+ pip3 install .
188
+ ```
189
+
190
+ ### You can then try the following example code
191
+
192
+ ```python
193
+ from awq import AutoAWQForCausalLM
194
+ from transformers import AutoTokenizer
195
+
196
+ model_name_or_path = "TheBloke/Llama-2-7B-vietnamese-20k-AWQ"
197
+
198
+ # Load model
199
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
200
+ trust_remote_code=False, safetensors=True)
201
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
202
+
203
+ prompt = "Tell me about AI"
204
+ prompt_template=f'''{prompt}
205
+
206
+ '''
207
+
208
+ print("\n\n*** Generate:")
209
+
210
+ tokens = tokenizer(
211
+ prompt_template,
212
+ return_tensors='pt'
213
+ ).input_ids.cuda()
214
+
215
+ # Generate output
216
+ generation_output = model.generate(
217
+ tokens,
218
+ do_sample=True,
219
+ temperature=0.7,
220
+ top_p=0.95,
221
+ top_k=40,
222
+ max_new_tokens=512
223
+ )
224
+
225
+ print("Output: ", tokenizer.decode(generation_output[0]))
226
+
227
+ """
228
+ # Inference should be possible with transformers pipeline as well in future
229
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
230
+ from transformers import pipeline
231
+
232
+ print("*** Pipeline:")
233
+ pipe = pipeline(
234
+ "text-generation",
235
+ model=model,
236
+ tokenizer=tokenizer,
237
+ max_new_tokens=512,
238
+ do_sample=True,
239
+ temperature=0.7,
240
+ top_p=0.95,
241
+ top_k=40,
242
+ repetition_penalty=1.1
243
+ )
244
+
245
+ print(pipe(prompt_template)[0]['generated_text'])
246
+ """
247
+ ```
248
+ <!-- README_AWQ.md-use-from-python end -->
249
+
250
+ <!-- README_AWQ.md-compatibility start -->
251
+ ## Compatibility
252
+
253
+ The files provided are tested to work with:
254
+
255
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
256
+ - [vLLM](https://github.com/vllm-project/vllm)
257
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
258
+
259
+ TGI merged AWQ support on September 25th, 2023: [TGI PR #1054](https://github.com/huggingface/text-generation-inference/pull/1054). Use the `:latest` Docker container until the next TGI release is made.
260
+
261
+ <!-- README_AWQ.md-compatibility end -->
262
+
263
+ <!-- footer start -->
264
+ <!-- 200823 -->
265
+ ## Discord
266
+
267
+ For further support, and discussions on these models and AI in general, join us at:
268
+
269
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
270
+
271
+ ## Thanks, and how to contribute
272
+
273
+ Thanks to the [chirper.ai](https://chirper.ai) team!
274
+
275
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
276
+
277
+ 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.
278
+
279
+ 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.
280
+
281
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
282
+
283
+ * Patreon: https://patreon.com/TheBlokeAI
284
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
285
+
286
+ **Special thanks to**: Aemon Algiz.
287
+
288
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
289
+
290
+
291
+ Thank you to all my generous patrons and donaters!
292
+
293
+ And thank you again to a16z for their generous grant.
294
+
295
+ <!-- footer end -->
296
+
297
+ # Original model card: Pham Van Ngoan's Llama 2 7B Vietnamese 20K
298
+
299
+ # Model Card for Llama 2 Fine-Tuned on Vietnamese Instructions
300
+
301
+ ## Model Details
302
+ - Model Name: Llama-2-7b-vietnamese-20k
303
+ - Architecture: Llama 2 7B
304
+ - Fine-tuning Data Size: 20,000 instruction samples
305
+ - Purpose: To demonstrate the performance of the Llama 2 model on Vietnamese and gather initial insights. A more comprehensive model and evaluation will be released soon.
306
+ - Availability: The model checkpoint can be accessed on Hugging Face: ngoantech/Llama-2-7b-vietnamese-20k
307
+
308
+ ## Intended Use
309
+ This model is intended for researchers, developers, and enthusiasts who are interested in understanding the performance of the Llama 2 model on Vietnamese. It can be used for generating Vietnamese text based on given instructions or for any other task that requires a Vietnamese language model.
310
+
311
+ ## Example Output
312
+ ![Example output 1](exp_1.png "Example output 1")
313
+
314
+
315
+ ## Limitations
316
+ - Data Size: The model was fine-tuned on a relatively small dataset of 20,000 instruction samples, which might not capture the full complexity and nuances of the Vietnamese language.
317
+ - Preliminary Model: This is an initial experiment with the Llama 2 architecture on Vietnamese. More refined versions and evaluations will be available soon.
318
+ - Performance:
319
+ Specific performance metrics on this fine-tuned model will be provided in the upcoming comprehensive evaluation.
320
+
321
+ ## Ethical Considerations
322
+ - Bias and Fairness: Like any other machine learning model, there is a possibility that this model might reproduce or amplify biases present in the training data.
323
+ - Use in Critical Systems: As this is a preliminary model, it is recommended not to use it for mission-critical applications without proper validation.
324
+ - Fine-tuning Data:
325
+ The model was fine-tuned on a custom dataset of 20,000 instruction samples in Vietnamese. More details about the composition and source of this dataset will be provided in the detailed evaluation report.
326
+
327
+
328
+
329
+ ## Credits
330
+ I would like to express our gratitude to the creators of the Llama 2 architecture and the Hugging Face community for their tools and resources.
331
+
332
+ ## Contact
333
334
+
335
+ https://github.com/ngoanpv