TheBloke commited on
Commit
c51fb37
1 Parent(s): af815aa

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +346 -0
README.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/bofenghuang/vigogne-2-7b-chat
3
+ inference: false
4
+ language:
5
+ - fr
6
+ library_name: transformers
7
+ license: llama2
8
+ model_creator: bofenghuang
9
+ model_name: Vigogne 2 7B Chat
10
+ model_type: llama
11
+ pipeline_tag: text-generation
12
+ prompt_template: "Below is a conversation between a user and an AI assistant named\
13
+ \ Vigogne.\nVigogne is polite, emotionally aware, humble-but-knowledgeable, always\
14
+ \ providing helpful and detailed answers.\nVigogne is skilled in responding proficiently\
15
+ \ in the languages its users use and can perform a wide range of tasks such as text\
16
+ \ editing, translation, question answering, logical reasoning, coding, and many\
17
+ \ others.\nVigogne cannot receive or generate audio or visual content and cannot\
18
+ \ access the internet.\nVigogne strictly avoids discussing sensitive, offensive,\
19
+ \ illegal, ethical, or political topics and caveats when unsure of the answer.\n\
20
+ \n<|UTILISATEUR|>: {prompt}\n<|ASSISTANT|>: \n"
21
+ quantized_by: TheBloke
22
+ tags:
23
+ - LLM
24
+ - llama
25
+ - llama-2
26
+ ---
27
+
28
+ <!-- header start -->
29
+ <!-- 200823 -->
30
+ <div style="width: auto; margin-left: auto; margin-right: auto">
31
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
32
+ </div>
33
+ <div style="display: flex; justify-content: space-between; width: 100%;">
34
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
35
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
36
+ </div>
37
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
38
+ <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>
39
+ </div>
40
+ </div>
41
+ <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>
42
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
43
+ <!-- header end -->
44
+
45
+ # Vigogne 2 7B Chat - AWQ
46
+ - Model creator: [bofenghuang](https://huggingface.co/bofenghuang)
47
+ - Original model: [Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
48
+
49
+ <!-- description start -->
50
+ ## Description
51
+
52
+ This repo contains AWQ model files for [bofenghuang's Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat).
53
+
54
+
55
+ ### About AWQ
56
+
57
+ 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.
58
+
59
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM 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.
60
+ <!-- description end -->
61
+ <!-- repositories-available start -->
62
+ ## Repositories available
63
+
64
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-AWQ)
65
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ)
66
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GGUF)
67
+ * [bofenghuang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
68
+ <!-- repositories-available end -->
69
+
70
+ <!-- prompt-template start -->
71
+ ## Prompt template: Vigogne-Chat
72
+
73
+ ```
74
+ Below is a conversation between a user and an AI assistant named Vigogne.
75
+ Vigogne is polite, emotionally aware, humble-but-knowledgeable, always providing helpful and detailed answers.
76
+ Vigogne is skilled in responding proficiently in the languages its users use and can perform a wide range of tasks such as text editing, translation, question answering, logical reasoning, coding, and many others.
77
+ Vigogne cannot receive or generate audio or visual content and cannot access the internet.
78
+ Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
79
+
80
+ <|UTILISATEUR|>: {prompt}
81
+ <|ASSISTANT|>:
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+
87
+
88
+ <!-- README_AWQ.md-provided-files start -->
89
+ ## Provided files and AWQ parameters
90
+
91
+ 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.
92
+
93
+ Models are released as sharded safetensors files.
94
+
95
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
96
+ | ------ | ---- | -- | ----------- | ------- | ---- |
97
+ | [main](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-AWQ/tree/main) | 4 | 128 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 3.89 GB
98
+
99
+ <!-- README_AWQ.md-provided-files end -->
100
+
101
+ <!-- README_AWQ.md-use-from-vllm start -->
102
+ ## Serving this model from vLLM
103
+
104
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
105
+
106
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
107
+
108
+ ```shell
109
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Vigogne-2-7B-Chat-AWQ --quantization awq
110
+ ```
111
+
112
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
113
+
114
+ ```python
115
+ from vllm import LLM, SamplingParams
116
+
117
+ prompts = [
118
+ "Hello, my name is",
119
+ "The president of the United States is",
120
+ "The capital of France is",
121
+ "The future of AI is",
122
+ ]
123
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
124
+
125
+ llm = LLM(model="TheBloke/Vigogne-2-7B-Chat-AWQ", quantization="awq")
126
+
127
+ outputs = llm.generate(prompts, sampling_params)
128
+
129
+ # Print the outputs.
130
+ for output in outputs:
131
+ prompt = output.prompt
132
+ generated_text = output.outputs[0].text
133
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
134
+ ```
135
+ <!-- README_AWQ.md-use-from-vllm start -->
136
+
137
+ <!-- README_AWQ.md-use-from-python start -->
138
+ ## How to use this AWQ model from Python code
139
+
140
+ ### Install the necessary packages
141
+
142
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
143
+
144
+ ```shell
145
+ pip3 install autoawq
146
+ ```
147
+
148
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
149
+
150
+ ```shell
151
+ pip3 uninstall -y autoawq
152
+ git clone https://github.com/casper-hansen/AutoAWQ
153
+ cd AutoAWQ
154
+ pip3 install .
155
+ ```
156
+
157
+ ### You can then try the following example code
158
+
159
+ ```python
160
+ from awq import AutoAWQForCausalLM
161
+ from transformers import AutoTokenizer
162
+
163
+ model_name_or_path = "TheBloke/Vigogne-2-7B-Chat-AWQ"
164
+
165
+ # Load model
166
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
167
+ trust_remote_code=False, safetensors=True)
168
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
169
+
170
+ prompt = "Tell me about AI"
171
+ prompt_template=f'''Below is a conversation between a user and an AI assistant named Vigogne.
172
+ Vigogne is polite, emotionally aware, humble-but-knowledgeable, always providing helpful and detailed answers.
173
+ Vigogne is skilled in responding proficiently in the languages its users use and can perform a wide range of tasks such as text editing, translation, question answering, logical reasoning, coding, and many others.
174
+ Vigogne cannot receive or generate audio or visual content and cannot access the internet.
175
+ Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
176
+
177
+ <|UTILISATEUR|>: {prompt}
178
+ <|ASSISTANT|>:
179
+
180
+ '''
181
+
182
+ print("\n\n*** Generate:")
183
+
184
+ tokens = tokenizer(
185
+ prompt_template,
186
+ return_tensors='pt'
187
+ ).input_ids.cuda()
188
+
189
+ # Generate output
190
+ generation_output = model.generate(
191
+ tokens,
192
+ do_sample=True,
193
+ temperature=0.7,
194
+ top_p=0.95,
195
+ top_k=40,
196
+ max_new_tokens=512
197
+ )
198
+
199
+ print("Output: ", tokenizer.decode(generation_output[0]))
200
+
201
+ # Inference can also be done using transformers' pipeline
202
+ from transformers import pipeline
203
+
204
+ print("*** Pipeline:")
205
+ pipe = pipeline(
206
+ "text-generation",
207
+ model=model,
208
+ tokenizer=tokenizer,
209
+ max_new_tokens=512,
210
+ do_sample=True,
211
+ temperature=0.7,
212
+ top_p=0.95,
213
+ top_k=40,
214
+ repetition_penalty=1.1
215
+ )
216
+
217
+ print(pipe(prompt_template)[0]['generated_text'])
218
+ ```
219
+ <!-- README_AWQ.md-use-from-python end -->
220
+
221
+ <!-- README_AWQ.md-compatibility start -->
222
+ ## Compatibility
223
+
224
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
225
+
226
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
227
+ <!-- README_AWQ.md-compatibility end -->
228
+
229
+ <!-- footer start -->
230
+ <!-- 200823 -->
231
+ ## Discord
232
+
233
+ For further support, and discussions on these models and AI in general, join us at:
234
+
235
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
236
+
237
+ ## Thanks, and how to contribute
238
+
239
+ Thanks to the [chirper.ai](https://chirper.ai) team!
240
+
241
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
242
+
243
+ 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.
244
+
245
+ 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.
246
+
247
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
248
+
249
+ * Patreon: https://patreon.com/TheBlokeAI
250
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
251
+
252
+ **Special thanks to**: Aemon Algiz.
253
+
254
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
255
+
256
+
257
+ Thank you to all my generous patrons and donaters!
258
+
259
+ And thank you again to a16z for their generous grant.
260
+
261
+ <!-- footer end -->
262
+
263
+ # Original model card: bofenghuang's Vigogne 2 7B Chat
264
+
265
+
266
+ <p align="center" width="100%">
267
+ <img src="https://huggingface.co/bofenghuang/vigogne-2-7b-chat/resolve/v2.0/logo_v2.jpg" alt="Vigogne" style="width: 30%; min-width: 300px; display: block; margin: auto;">
268
+ </p>
269
+
270
+ # Vigogne-2-7B-Chat-V2.0: A Llama-2 based French chat LLM
271
+
272
+ Vigogne-2-7B-Chat-V2.0 is a French chat LLM, based on [LLaMA-2-7B](https://ai.meta.com/llama), optimized to generate helpful and coherent responses in user conversations.
273
+
274
+ Check out our [blog](https://github.com/bofenghuang/vigogne/blob/main/blogs/2023-08-17-vigogne-chat-v2_0.md) and [GitHub repository](https://github.com/bofenghuang/vigogne) for more information.
275
+
276
+ **Usage and License Notices**: Vigogne-2-7B-Chat-V2.0 follows Llama-2's [usage policy](https://ai.meta.com/llama/use-policy). A significant portion of the training data is distilled from GPT-3.5-Turbo and GPT-4, kindly use it cautiously to avoid any violations of OpenAI's [terms of use](https://openai.com/policies/terms-of-use).
277
+
278
+ ## Changelog
279
+
280
+ All previous versions are accessible through branches.
281
+
282
+ - **V1.0**: Trained on 420K chat data.
283
+ - **V2.0**: Trained on 520K data. Check out our [blog](https://github.com/bofenghuang/vigogne/blob/main/blogs/2023-08-17-vigogne-chat-v2_0.md) for more details.
284
+
285
+ ## Usage
286
+
287
+ ```python
288
+ import torch
289
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, TextStreamer
290
+ from vigogne.preprocess import generate_inference_chat_prompt
291
+
292
+ model_name_or_path = "bofenghuang/vigogne-2-7b-chat"
293
+ revision = "v2.0"
294
+
295
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, revision=revision, padding_side="right", use_fast=False)
296
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path, revision=revision, torch_dtype=torch.float16, device_map="auto")
297
+
298
+ streamer = TextStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
299
+
300
+
301
+ def infer(
302
+ utterances,
303
+ system_message=None,
304
+ temperature=0.1,
305
+ top_p=1.0,
306
+ top_k=0,
307
+ repetition_penalty=1.1,
308
+ max_new_tokens=1024,
309
+ **kwargs,
310
+ ):
311
+ prompt = generate_inference_chat_prompt(utterances, tokenizer, system_message=system_message)
312
+ input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to(model.device)
313
+ input_length = input_ids.shape[1]
314
+
315
+ generated_outputs = model.generate(
316
+ input_ids=input_ids,
317
+ generation_config=GenerationConfig(
318
+ temperature=temperature,
319
+ do_sample=temperature > 0.0,
320
+ top_p=top_p,
321
+ top_k=top_k,
322
+ repetition_penalty=repetition_penalty,
323
+ max_new_tokens=max_new_tokens,
324
+ eos_token_id=tokenizer.eos_token_id,
325
+ pad_token_id=tokenizer.pad_token_id,
326
+ **kwargs,
327
+ ),
328
+ streamer=streamer,
329
+ return_dict_in_generate=True,
330
+ )
331
+ generated_tokens = generated_outputs.sequences[0, input_length:]
332
+ generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
333
+ return generated_text
334
+
335
+
336
+ user_query = "Expliquez la différence entre DoS et phishing."
337
+ infer([[user_query, ""]])
338
+ ```
339
+
340
+ You can utilize the Google Colab Notebook below for inferring with the Vigogne chat models.
341
+
342
+ <a href="https://colab.research.google.com/github/bofenghuang/vigogne/blob/main/notebooks/infer_chat.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
343
+
344
+ ## Limitations
345
+
346
+ Vigogne is still under development, and there are many limitations that have to be addressed. Please note that it is possible that the model generates harmful or biased content, incorrect information or generally unhelpful answers.