TheBloke commited on
Commit
7e86137
1 Parent(s): 3f4e2b5

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +479 -0
README.md ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: bofenghuang/vigogne-2-70b-chat
3
+ inference: false
4
+ language: fr
5
+ license: llama2
6
+ model_creator: bofeng huang
7
+ model_name: Vigogne 2 70B Chat
8
+ model_type: llama
9
+ pipeline_tag: text-generation
10
+ prompt_template: "<s>[INST] <<SYS>>\nVous \xEAtes Vigogne, un assistant IA cr\xE9\xE9\
11
+ \ par Zaion Lab. Vous suivez extr\xEAmement bien les instructions. Aidez autant\
12
+ \ que vous le pouvez.\n<</SYS>>\n\n{prompt} [/INST] \n"
13
+ quantized_by: TheBloke
14
+ tags:
15
+ - LLM
16
+ - llama-2
17
+ - finetuned
18
+ ---
19
+ <!-- markdownlint-disable MD041 -->
20
+
21
+ <!-- header start -->
22
+ <!-- 200823 -->
23
+ <div style="width: auto; margin-left: auto; margin-right: auto">
24
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
25
+ </div>
26
+ <div style="display: flex; justify-content: space-between; width: 100%;">
27
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
28
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
29
+ </div>
30
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
31
+ <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>
32
+ </div>
33
+ </div>
34
+ <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>
35
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
36
+ <!-- header end -->
37
+
38
+ # Vigogne 2 70B Chat - AWQ
39
+ - Model creator: [bofeng huang](https://huggingface.co/bofenghuang)
40
+ - Original model: [Vigogne 2 70B Chat](https://huggingface.co/bofenghuang/vigogne-2-70b-chat)
41
+
42
+ <!-- description start -->
43
+ ## Description
44
+
45
+ This repo contains AWQ model files for [bofeng huang's Vigogne 2 70B Chat](https://huggingface.co/bofenghuang/vigogne-2-70b-chat).
46
+
47
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
48
+
49
+
50
+ ### About AWQ
51
+
52
+ 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.
53
+
54
+ It is supported by:
55
+
56
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
57
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
58
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
59
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
60
+
61
+ <!-- description end -->
62
+ <!-- repositories-available start -->
63
+ ## Repositories available
64
+
65
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/vigogne-2-70B-chat-AWQ)
66
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/vigogne-2-70B-chat-GPTQ)
67
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/vigogne-2-70B-chat-GGUF)
68
+ * [bofeng huang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bofenghuang/vigogne-2-70b-chat)
69
+ <!-- repositories-available end -->
70
+
71
+ <!-- prompt-template start -->
72
+ ## Prompt template: Vigogne-Llama-2-Chat
73
+
74
+ ```
75
+ <s>[INST] <<SYS>>
76
+ Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
77
+ <</SYS>>
78
+
79
+ {prompt} [/INST]
80
+
81
+ ```
82
+
83
+ <!-- prompt-template end -->
84
+
85
+
86
+ <!-- README_AWQ.md-provided-files start -->
87
+ ## Provided files, and AWQ parameters
88
+
89
+ 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.
90
+
91
+ Models are released as sharded safetensors files.
92
+
93
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
94
+ | ------ | ---- | -- | ----------- | ------- | ---- |
95
+ | [main](https://huggingface.co/TheBloke/vigogne-2-70B-chat-AWQ/tree/main) | 4 | 128 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 36.61 GB
96
+
97
+ <!-- README_AWQ.md-provided-files end -->
98
+
99
+ <!-- README_AWQ.md-text-generation-webui start -->
100
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
101
+
102
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
103
+
104
+ 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.
105
+
106
+ 1. Click the **Model tab**.
107
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/vigogne-2-70B-chat-AWQ`.
108
+ 3. Click **Download**.
109
+ 4. The model will start downloading. Once it's finished it will say "Done".
110
+ 5. In the top left, click the refresh icon next to **Model**.
111
+ 6. In the **Model** dropdown, choose the model you just downloaded: `vigogne-2-70B-chat-AWQ`
112
+ 7. Select **Loader: AutoAWQ**.
113
+ 8. Click Load, and the model will load and is now ready for use.
114
+ 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.
115
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
116
+ <!-- README_AWQ.md-text-generation-webui end -->
117
+
118
+ <!-- README_AWQ.md-use-from-vllm start -->
119
+ ## Multi-user inference server: vLLM
120
+
121
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
122
+
123
+ - Please ensure you are using vLLM version 0.2 or later.
124
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
125
+
126
+ For example:
127
+
128
+ ```shell
129
+ python3 -m vllm.entrypoints.api_server --model TheBloke/vigogne-2-70B-chat-AWQ --quantization awq
130
+ ```
131
+
132
+ - When using vLLM from Python code, again set `quantization=awq`.
133
+
134
+ For example:
135
+
136
+ ```python
137
+ from vllm import LLM, SamplingParams
138
+
139
+ prompts = [
140
+ "Tell me about AI",
141
+ "Write a story about llamas",
142
+ "What is 291 - 150?",
143
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
144
+ ]
145
+ prompt_template=f'''<s>[INST] <<SYS>>
146
+ Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
147
+ <</SYS>>
148
+
149
+ {prompt} [/INST]
150
+ '''
151
+
152
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
153
+
154
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
155
+
156
+ llm = LLM(model="TheBloke/vigogne-2-70B-chat-AWQ", quantization="awq", dtype="auto")
157
+
158
+ outputs = llm.generate(prompts, sampling_params)
159
+
160
+ # Print the outputs.
161
+ for output in outputs:
162
+ prompt = output.prompt
163
+ generated_text = output.outputs[0].text
164
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
165
+ ```
166
+ <!-- README_AWQ.md-use-from-vllm start -->
167
+
168
+ <!-- README_AWQ.md-use-from-tgi start -->
169
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
170
+
171
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
172
+
173
+ Example Docker parameters:
174
+
175
+ ```shell
176
+ --model-id TheBloke/vigogne-2-70B-chat-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
177
+ ```
178
+
179
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
180
+
181
+ ```shell
182
+ pip3 install huggingface-hub
183
+ ```
184
+
185
+ ```python
186
+ from huggingface_hub import InferenceClient
187
+
188
+ endpoint_url = "https://your-endpoint-url-here"
189
+
190
+ prompt = "Tell me about AI"
191
+ prompt_template=f'''<s>[INST] <<SYS>>
192
+ Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
193
+ <</SYS>>
194
+
195
+ {prompt} [/INST]
196
+ '''
197
+
198
+ client = InferenceClient(endpoint_url)
199
+ response = client.text_generation(prompt,
200
+ max_new_tokens=128,
201
+ do_sample=True,
202
+ temperature=0.7,
203
+ top_p=0.95,
204
+ top_k=40,
205
+ repetition_penalty=1.1)
206
+
207
+ print(f"Model output: ", response)
208
+ ```
209
+ <!-- README_AWQ.md-use-from-tgi end -->
210
+
211
+ <!-- README_AWQ.md-use-from-python start -->
212
+ ## Inference from Python code using AutoAWQ
213
+
214
+ ### Install the AutoAWQ package
215
+
216
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
217
+
218
+ ```shell
219
+ pip3 install autoawq
220
+ ```
221
+
222
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
223
+
224
+ ```shell
225
+ pip3 uninstall -y autoawq
226
+ git clone https://github.com/casper-hansen/AutoAWQ
227
+ cd AutoAWQ
228
+ pip3 install .
229
+ ```
230
+
231
+ ### AutoAWQ example code
232
+
233
+ ```python
234
+ from awq import AutoAWQForCausalLM
235
+ from transformers import AutoTokenizer
236
+
237
+ model_name_or_path = "TheBloke/vigogne-2-70B-chat-AWQ"
238
+
239
+ # Load tokenizer
240
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
241
+ # Load model
242
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
243
+ trust_remote_code=False, safetensors=True)
244
+
245
+ prompt = "Tell me about AI"
246
+ prompt_template=f'''<s>[INST] <<SYS>>
247
+ Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
248
+ <</SYS>>
249
+
250
+ {prompt} [/INST]
251
+ '''
252
+
253
+ print("*** Running model.generate:")
254
+
255
+ token_input = tokenizer(
256
+ prompt_template,
257
+ return_tensors='pt'
258
+ ).input_ids.cuda()
259
+
260
+ # Generate output
261
+ generation_output = model.generate(
262
+ token_input,
263
+ do_sample=True,
264
+ temperature=0.7,
265
+ top_p=0.95,
266
+ top_k=40,
267
+ max_new_tokens=512
268
+ )
269
+
270
+ # Get the tokens from the output, decode them, print them
271
+ token_output = generation_output[0]
272
+ text_output = tokenizer.decode(token_output)
273
+ print("LLM output: ", text_output)
274
+
275
+ """
276
+ # Inference should be possible with transformers pipeline as well in future
277
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
278
+ from transformers import pipeline
279
+
280
+ print("*** Pipeline:")
281
+ pipe = pipeline(
282
+ "text-generation",
283
+ model=model,
284
+ tokenizer=tokenizer,
285
+ max_new_tokens=512,
286
+ do_sample=True,
287
+ temperature=0.7,
288
+ top_p=0.95,
289
+ top_k=40,
290
+ repetition_penalty=1.1
291
+ )
292
+
293
+ print(pipe(prompt_template)[0]['generated_text'])
294
+ """
295
+ ```
296
+ <!-- README_AWQ.md-use-from-python end -->
297
+
298
+ <!-- README_AWQ.md-compatibility start -->
299
+ ## Compatibility
300
+
301
+ The files provided are tested to work with:
302
+
303
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
304
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
305
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
306
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
307
+
308
+ <!-- README_AWQ.md-compatibility end -->
309
+
310
+ <!-- footer start -->
311
+ <!-- 200823 -->
312
+ ## Discord
313
+
314
+ For further support, and discussions on these models and AI in general, join us at:
315
+
316
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
317
+
318
+ ## Thanks, and how to contribute
319
+
320
+ Thanks to the [chirper.ai](https://chirper.ai) team!
321
+
322
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
323
+
324
+ 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.
325
+
326
+ 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.
327
+
328
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
329
+
330
+ * Patreon: https://patreon.com/TheBlokeAI
331
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
332
+
333
+ **Special thanks to**: Aemon Algiz.
334
+
335
+ **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
336
+
337
+
338
+ Thank you to all my generous patrons and donaters!
339
+
340
+ And thank you again to a16z for their generous grant.
341
+
342
+ <!-- footer end -->
343
+
344
+ # Original model card: bofeng huang's Vigogne 2 70B Chat
345
+
346
+
347
+ <p align="center" width="100%">
348
+ <img src="https://huggingface.co/bofenghuang/vigogne-2-70b-chat/resolve/main/logo_v2.jpg" alt="Vigogne" style="width: 30%; min-width: 300px; display: block; margin: auto;">
349
+ </p>
350
+
351
+ # Vigogne-2-70B-Chat: A Llama-2-based French Chat LLM
352
+
353
+ Vigogne-2-70B-Chat is a French chat LLM, based on [Llama-2-70B](https://ai.meta.com/llama), optimized to generate helpful and coherent responses in conversations with users.
354
+
355
+ Check out our [release 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.
356
+
357
+ **Usage and License Notices**: Vigogne-2-70B-Chat 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).
358
+
359
+ ## Prompt Template
360
+
361
+ We used a prompt template adapted from the chat format of Llama-2.
362
+
363
+ You can apply this formatting using the [chat template](https://huggingface.co/docs/transformers/main/chat_templating) through the `apply_chat_template()` method.
364
+
365
+ ```python
366
+ from transformers import AutoTokenizer
367
+
368
+ tokenizer = AutoTokenizer.from_pretrained("bofenghuang/vigogne-2-70b-chat")
369
+
370
+ conversation = [
371
+ {"role": "user", "content": "Bonjour ! Comment ça va aujourd'hui ?"},
372
+ {"role": "assistant", "content": "Bonjour ! Je suis une IA, donc je n'ai pas de sentiments, mais je suis prêt à vous aider. Comment puis-je vous assister aujourd'hui ?"},
373
+ {"role": "user", "content": "Quelle est la hauteur de la Tour Eiffel ?"},
374
+ {"role": "assistant", "content": "La Tour Eiffel mesure environ 330 mètres de hauteur."},
375
+ {"role": "user", "content": "Comment monter en haut ?"},
376
+ ]
377
+
378
+ print(tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True))
379
+ ```
380
+
381
+ You will get
382
+
383
+ ```
384
+ <s>[INST] <<SYS>>
385
+ Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.
386
+ <</SYS>>
387
+
388
+ Bonjour ! Comment ça va aujourd'hui ? [/INST] Bonjour ! Je suis une IA, donc je n'ai pas de sentiments, mais je suis prêt à vous aider. Comment puis-je vous assister aujourd'hui ? </s>[INST] Quelle est la hauteur de la Tour Eiffel ? [/INST] La Tour Eiffel mesure environ 330 mètres de hauteur. </s>[INST] Comment monter en haut ? [/INST]
389
+ ```
390
+
391
+ ## Usage
392
+
393
+ <!-- ### Inference using the quantized versions
394
+
395
+ The quantized versions of this model are generously provided by [TheBloke](https://huggingface.co/TheBloke)!
396
+
397
+ - AWQ for GPU inference: [TheBloke/Vigogne-2-70B-Chat-AWQ](https://huggingface.co/TheBloke/Vigogne-2-70B-Chat-AWQ)
398
+ - GTPQ for GPU inference: [TheBloke/Vigogne-2-70B-Chat-GPTQ](https://huggingface.co/TheBloke/Vigogne-2-70B-Chat-GPTQ)
399
+ - GGUF for CPU+GPU inference: [TheBloke/Vigogne-2-70B-Chat-GGUF](https://huggingface.co/TheBloke/Vigogne-2-70B-Chat-GGUF)
400
+
401
+ These versions facilitate testing and development with various popular frameworks, including [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), [vLLM](https://github.com/vllm-project/vllm), [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ), [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa), [llama.cpp](https://github.com/ggerganov/llama.cpp), [text-generation-webui](https://github.com/oobabooga/text-generation-webui), and more. -->
402
+
403
+ ### Inference using the unquantized model with 🤗 Transformers
404
+
405
+ ```python
406
+ from typing import Dict, List, Optional
407
+ import torch
408
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, TextStreamer
409
+
410
+ model_name_or_path = "bofenghuang/vigogne-2-70b-chat"
411
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, padding_side="right", use_fast=False)
412
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path, torch_dtype=torch.float16, device_map="auto")
413
+
414
+ streamer = TextStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
415
+
416
+
417
+ def chat(
418
+ query: str,
419
+ history: Optional[List[Dict]] = None,
420
+ temperature: float = 0.7,
421
+ top_p: float = 1.0,
422
+ top_k: float = 0,
423
+ repetition_penalty: float = 1.1,
424
+ max_new_tokens: int = 1024,
425
+ **kwargs,
426
+ ):
427
+ if history is None:
428
+ history = []
429
+
430
+ history.append({"role": "user", "content": query})
431
+
432
+ input_ids = tokenizer.apply_chat_template(history, return_tensors="pt").to(model.device)
433
+ input_length = input_ids.shape[1]
434
+
435
+ generated_outputs = model.generate(
436
+ input_ids=input_ids,
437
+ generation_config=GenerationConfig(
438
+ temperature=temperature,
439
+ do_sample=temperature > 0.0,
440
+ top_p=top_p,
441
+ top_k=top_k,
442
+ repetition_penalty=repetition_penalty,
443
+ max_new_tokens=max_new_tokens,
444
+ pad_token_id=tokenizer.eos_token_id,
445
+ **kwargs,
446
+ ),
447
+ streamer=streamer,
448
+ return_dict_in_generate=True,
449
+ )
450
+
451
+ generated_tokens = generated_outputs.sequences[0, input_length:]
452
+ generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
453
+
454
+ history.append({"role": "assistant", "content": generated_text})
455
+
456
+ return generated_text, history
457
+
458
+
459
+ # 1st round
460
+ response, history = chat("Un escargot parcourt 100 mètres en 5 heures. Quelle est sa vitesse ?", history=None)
461
+
462
+ # 2nd round
463
+ response, history = chat("Quand il peut dépasser le lapin ?", history=history)
464
+
465
+ # 3rd round
466
+ response, history = chat("Écris une histoire imaginative qui met en scène une compétition de course entre un escargot et un lapin.", history=history)
467
+ ```
468
+
469
+ You can also use the Google Colab Notebook provided below.
470
+
471
+ <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>
472
+
473
+ ## Limitations
474
+
475
+ 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.
476
+
477
+ ## Acknowledgements
478
+
479
+ The model training was conducted on the [Jean-Zay supercomputer](http://www.idris.fr/eng/jean-zay/jean-zay-presentation-eng.html) at GENCI, and we extend our gratitude to the IDRIS team for their responsive support throughout the project.