TheBloke commited on
Commit
5e6dcc2
1 Parent(s): 4663374

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +126 -80
README.md CHANGED
@@ -3,7 +3,7 @@ inference: false
3
  language:
4
  - fr
5
  library_name: transformers
6
- license: other
7
  model_creator: bofenghuang
8
  model_link: https://huggingface.co/bofenghuang/vigogne-2-7b-chat
9
  model_name: Vigogne 2 7B Chat
@@ -37,18 +37,24 @@ tags:
37
  - Model creator: [bofenghuang](https://huggingface.co/bofenghuang)
38
  - Original model: [Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
39
 
 
40
  ## Description
41
 
42
  This repo contains GPTQ model files for [bofenghuang's Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat).
43
 
44
  Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
45
 
 
 
46
  ## Repositories available
47
 
48
  * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ)
49
- * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GGML)
 
50
  * [bofenghuang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
 
51
 
 
52
  ## Prompt template: Vigogne-Chat
53
 
54
  ```
@@ -59,23 +65,27 @@ Vigogne cannot receive or generate audio or visual content and cannot access the
59
  Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
60
 
61
  <|UTILISATEUR|>: {prompt}
62
- <|ASSISTANT|>:
 
63
  ```
64
 
 
 
 
65
  ## Provided files and GPTQ parameters
66
 
67
  Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
68
 
69
  Each separate quant is in a different branch. See below for instructions on fetching from different branches.
70
 
71
- All GPTQ files are made with AutoGPTQ.
72
 
73
  <details>
74
  <summary>Explanation of GPTQ parameters</summary>
75
 
76
  - Bits: The bit size of the quantised model.
77
  - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
78
- - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have issues with models that use Act Order plus Group Size.
79
  - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
80
  - GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
81
  - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
@@ -85,15 +95,18 @@ All GPTQ files are made with AutoGPTQ.
85
 
86
  | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
87
  | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
88
- | [main](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 3.90 GB | Yes | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
89
- | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
90
- | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
91
- | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 3.90 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
92
- | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
93
- | [gptq-8bit-128g-actorder_False](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-128g-actorder_False) | 8 | 128 | No | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
94
- | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
95
- | [gptq-8bit-64g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-64g-actorder_True) | 8 | 64 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.31 GB | No | 8-bit, with group size 64g and Act Order for maximum inference quality. Poor AutoGPTQ CUDA speed. |
96
-
 
 
 
97
  ## How to download from branches
98
 
99
  - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Vigogne-2-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
@@ -102,73 +115,72 @@ All GPTQ files are made with AutoGPTQ.
102
  git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ
103
  ```
104
  - In Python Transformers code, the branch is the `revision` parameter; see below.
105
-
 
106
  ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
107
 
108
  Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
109
 
110
- It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
111
 
112
  1. Click the **Model tab**.
113
  2. Under **Download custom model or LoRA**, enter `TheBloke/Vigogne-2-7B-Chat-GPTQ`.
114
  - To download from a specific branch, enter for example `TheBloke/Vigogne-2-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
115
  - see Provided Files above for the list of branches for each option.
116
  3. Click **Download**.
117
- 4. The model will start downloading. Once it's finished it will say "Done"
118
  5. In the top left, click the refresh icon next to **Model**.
119
  6. In the **Model** dropdown, choose the model you just downloaded: `Vigogne-2-7B-Chat-GPTQ`
120
  7. The model will automatically load, and is now ready for use!
121
  8. 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.
122
- * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
123
  9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
 
124
 
 
125
  ## How to use this GPTQ model from Python code
126
 
127
- First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) 0.3.1 or later installed:
128
 
129
- ```
130
- pip3 install auto-gptq
131
- ```
132
 
133
- If you have problems installing AutoGPTQ, please build from source instead:
 
 
134
  ```
 
 
 
 
135
  pip3 uninstall -y auto-gptq
136
  git clone https://github.com/PanQiWei/AutoGPTQ
137
  cd AutoGPTQ
138
  pip3 install .
139
  ```
140
 
141
- Then try the following example code:
 
 
 
 
 
 
 
 
142
 
143
  ```python
144
- from transformers import AutoTokenizer, pipeline, logging
145
- from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
146
 
147
  model_name_or_path = "TheBloke/Vigogne-2-7B-Chat-GPTQ"
148
-
149
- use_triton = False
 
 
 
 
150
 
151
  tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
152
 
153
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
154
- use_safetensors=True,
155
- trust_remote_code=False,
156
- device="cuda:0",
157
- use_triton=use_triton,
158
- quantize_config=None)
159
-
160
- """
161
- # To download from a specific branch, use the revision parameter, as in this example:
162
- # Note that `revision` requires AutoGPTQ 0.3.1 or later!
163
-
164
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
165
- revision="gptq-4bit-32g-actorder_True",
166
- use_safetensors=True,
167
- trust_remote_code=False,
168
- device="cuda:0",
169
- quantize_config=None)
170
- """
171
-
172
  prompt = "Tell me about AI"
173
  prompt_template=f'''Below is a conversation between a user and an AI assistant named Vigogne.
174
  Vigogne is polite, emotionally aware, humble-but-knowledgeable, always providing helpful and detailed answers.
@@ -177,7 +189,8 @@ Vigogne cannot receive or generate audio or visual content and cannot access the
177
  Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
178
 
179
  <|UTILISATEUR|>: {prompt}
180
- <|ASSISTANT|>:
 
181
  '''
182
 
183
  print("\n\n*** Generate:")
@@ -188,9 +201,6 @@ print(tokenizer.decode(output[0]))
188
 
189
  # Inference can also be done using transformers' pipeline
190
 
191
- # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
192
- logging.set_verbosity(logging.CRITICAL)
193
-
194
  print("*** Pipeline:")
195
  pipe = pipeline(
196
  "text-generation",
@@ -204,12 +214,17 @@ pipe = pipeline(
204
 
205
  print(pipe(prompt_template)[0]['generated_text'])
206
  ```
 
207
 
 
208
  ## Compatibility
209
 
210
- The files provided will work with AutoGPTQ (CUDA and Triton modes), GPTQ-for-LLaMa (only CUDA has been tested), and Occ4m's GPTQ-for-LLaMa fork.
 
 
211
 
212
- ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
 
213
 
214
  <!-- footer start -->
215
  <!-- 200823 -->
@@ -234,7 +249,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
234
 
235
  **Special thanks to**: Aemon Algiz.
236
 
237
- **Patreon special mentions**: Sam, theTransient, Jonathan Leane, Steven Wood, webtim, Johann-Peter Hartmann, Geoffrey Montalvo, Gabriel Tamborski, Willem Michiel, John Villwock, Derek Yates, Mesiah Bishop, Eugene Pentland, Pieter, Chadd, Stephen Murray, Daniel P. Andersen, terasurfer, Brandon Frisco, Thomas Belote, Sid, Nathan LeClaire, Magnesian, Alps Aficionado, Stanislav Ovsiannikov, Alex, Joseph William Delisle, Nikolai Manek, Michael Davis, Junyu Yang, K, J, Spencer Kim, Stefan Sabev, Olusegun Samson, transmissions 11, Michael Levine, Cory Kujawski, Rainer Wilmers, zynix, Kalila, Luke @flexchar, Ajan Kanaga, Mandus, vamX, Ai Maven, Mano Prime, Matthew Berman, subjectnull, Vitor Caleffi, Clay Pascal, biorpg, alfie_i, 阿明, Jeffrey Morgan, ya boyyy, Raymond Fosdick, knownsqashed, Olakabola, Leonard Tan, ReadyPlayerEmma, Enrico Ros, Dave, Talal Aujan, Illia Dulskyi, Sean Connelly, senxiiz, Artur Olbinski, Elle, Raven Klaugh, Fen Risland, Deep Realms, Imad Khwaja, Fred von Graf, Will Dee, usrbinkat, SuperWojo, Alexandros Triantafyllidis, Swaroop Kallakuri, Dan Guido, John Detwiler, Pedro Madruga, Iucharbius, Viktor Bowallius, Asp the Wyvern, Edmond Seymore, Trenton Dambrowitz, Space Cruiser, Spiking Neurons AB, Pyrater, LangChain4j, Tony Hughes, Kacper Wikieł, Rishabh Srivastava, David Ziegler, Luke Pendergrass, Andrey, Gabriel Puliatti, Lone Striker, Sebastain Graf, Pierre Kircher, Randy H, NimbleBox.ai, Vadim, danny, Deo Leter
238
 
239
 
240
  Thank you to all my generous patrons and donaters!
@@ -247,49 +262,80 @@ And thank you again to a16z for their generous grant.
247
 
248
 
249
  <p align="center" width="100%">
250
- <img src="https://huggingface.co/bofenghuang/vigogne-2-7b-chat/resolve/main/vigogne_logo.png" alt="Vigogne" style="width: 40%; min-width: 300px; display: block; margin: auto;">
251
  </p>
252
 
253
- # Vigogne-2-7B-Chat: A Llama-2 based French chat model
254
 
255
- Vigogne-2-7B-Chat is a model based on [LLaMA-2-7B](https://ai.meta.com/llama) that has been fine-tuned to conduct multi-turn dialogues in French between human user and AI assistant.
256
 
257
- For more information, please visit the Github repo: https://github.com/bofenghuang/vigogne
258
 
259
- **Usage and License Notices**: Vigogne-2-7B-Chat follows the same usage policy as Llama-2, which can be found [here](https://ai.meta.com/llama/use-policy).
 
 
 
 
 
 
 
260
 
261
  ## Usage
262
 
263
  ```python
264
  import torch
265
- from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
266
  from vigogne.preprocess import generate_inference_chat_prompt
267
 
268
  model_name_or_path = "bofenghuang/vigogne-2-7b-chat"
269
- tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, padding_side="right", use_fast=False)
270
- model = AutoModelForCausalLM.from_pretrained(model_name_or_path, torch_dtype=torch.float16, device_map="auto")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  user_query = "Expliquez la différence entre DoS et phishing."
273
- prompt = generate_inference_chat_prompt([[user_query, ""]], tokenizer=tokenizer)
274
- input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to(model.device)
275
- input_length = input_ids.shape[1]
276
-
277
- generated_outputs = model.generate(
278
- input_ids=input_ids,
279
- generation_config=GenerationConfig(
280
- temperature=0.1,
281
- do_sample=True,
282
- repetition_penalty=1.0,
283
- max_new_tokens=512,
284
- ),
285
- return_dict_in_generate=True,
286
- )
287
- generated_tokens = generated_outputs.sequences[0, input_length:]
288
- generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
289
- print(generated_text)
290
  ```
291
 
292
- You can infer this model by using the following Google Colab Notebook.
293
 
294
  <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>
295
 
 
3
  language:
4
  - fr
5
  library_name: transformers
6
+ license: llama2
7
  model_creator: bofenghuang
8
  model_link: https://huggingface.co/bofenghuang/vigogne-2-7b-chat
9
  model_name: Vigogne 2 7B Chat
 
37
  - Model creator: [bofenghuang](https://huggingface.co/bofenghuang)
38
  - Original model: [Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
39
 
40
+ <!-- description start -->
41
  ## Description
42
 
43
  This repo contains GPTQ model files for [bofenghuang's Vigogne 2 7B Chat](https://huggingface.co/bofenghuang/vigogne-2-7b-chat).
44
 
45
  Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
46
 
47
+ <!-- description end -->
48
+ <!-- repositories-available start -->
49
  ## Repositories available
50
 
51
  * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ)
52
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GGUF)
53
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference (deprecated)](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GGML)
54
  * [bofenghuang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bofenghuang/vigogne-2-7b-chat)
55
+ <!-- repositories-available end -->
56
 
57
+ <!-- prompt-template start -->
58
  ## Prompt template: Vigogne-Chat
59
 
60
  ```
 
65
  Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
66
 
67
  <|UTILISATEUR|>: {prompt}
68
+ <|ASSISTANT|>:
69
+
70
  ```
71
 
72
+ <!-- prompt-template end -->
73
+
74
+ <!-- README_GPTQ.md-provided-files start -->
75
  ## Provided files and GPTQ parameters
76
 
77
  Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
78
 
79
  Each separate quant is in a different branch. See below for instructions on fetching from different branches.
80
 
81
+ All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
82
 
83
  <details>
84
  <summary>Explanation of GPTQ parameters</summary>
85
 
86
  - Bits: The bit size of the quantised model.
87
  - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
88
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
89
  - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
90
  - GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
91
  - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
 
95
 
96
  | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
97
  | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
98
+ | [main](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 3.90 GB | Yes | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
99
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
100
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
101
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 3.90 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
102
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
103
+ | [gptq-8bit-128g-actorder_False](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-128g-actorder_False) | 8 | 128 | No | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
104
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
105
+ | [gptq-8bit-64g-actorder_True](https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ/tree/gptq-8bit-64g-actorder_True) | 8 | 64 | Yes | 0.1 | [French news](https://huggingface.co/datasets/gustavecortal/diverse_french_news) | 4096 | 7.31 GB | No | 8-bit, with group size 64g and Act Order for even higher inference quality. Poor AutoGPTQ CUDA speed. |
106
+
107
+ <!-- README_GPTQ.md-provided-files end -->
108
+
109
+ <!-- README_GPTQ.md-download-from-branches start -->
110
  ## How to download from branches
111
 
112
  - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Vigogne-2-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
 
115
  git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Vigogne-2-7B-Chat-GPTQ
116
  ```
117
  - In Python Transformers code, the branch is the `revision` parameter; see below.
118
+ <!-- README_GPTQ.md-download-from-branches end -->
119
+ <!-- README_GPTQ.md-text-generation-webui start -->
120
  ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
121
 
122
  Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
123
 
124
+ 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.
125
 
126
  1. Click the **Model tab**.
127
  2. Under **Download custom model or LoRA**, enter `TheBloke/Vigogne-2-7B-Chat-GPTQ`.
128
  - To download from a specific branch, enter for example `TheBloke/Vigogne-2-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
129
  - see Provided Files above for the list of branches for each option.
130
  3. Click **Download**.
131
+ 4. The model will start downloading. Once it's finished it will say "Done".
132
  5. In the top left, click the refresh icon next to **Model**.
133
  6. In the **Model** dropdown, choose the model you just downloaded: `Vigogne-2-7B-Chat-GPTQ`
134
  7. The model will automatically load, and is now ready for use!
135
  8. 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.
136
+ * Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
137
  9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
138
+ <!-- README_GPTQ.md-text-generation-webui end -->
139
 
140
+ <!-- README_GPTQ.md-use-from-python start -->
141
  ## How to use this GPTQ model from Python code
142
 
143
+ ### Install the necessary packages
144
 
145
+ Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
 
 
146
 
147
+ ```shell
148
+ pip3 install transformers>=4.32.0 optimum>=1.12.0
149
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
150
  ```
151
+
152
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
153
+
154
+ ```shell
155
  pip3 uninstall -y auto-gptq
156
  git clone https://github.com/PanQiWei/AutoGPTQ
157
  cd AutoGPTQ
158
  pip3 install .
159
  ```
160
 
161
+ ### For CodeLlama models only: you must use Transformers 4.33.0 or later.
162
+
163
+ If 4.33.0 is not yet released when you read this, you will need to install Transformers from source:
164
+ ```shell
165
+ pip3 uninstall -y transformers
166
+ pip3 install git+https://github.com/huggingface/transformers.git
167
+ ```
168
+
169
+ ### You can then use the following code
170
 
171
  ```python
172
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
 
173
 
174
  model_name_or_path = "TheBloke/Vigogne-2-7B-Chat-GPTQ"
175
+ # To use a different branch, change revision
176
+ # For example: revision="gptq-4bit-32g-actorder_True"
177
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
178
+ torch_dtype=torch.float16,
179
+ device_map="auto",
180
+ revision="main")
181
 
182
  tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  prompt = "Tell me about AI"
185
  prompt_template=f'''Below is a conversation between a user and an AI assistant named Vigogne.
186
  Vigogne is polite, emotionally aware, humble-but-knowledgeable, always providing helpful and detailed answers.
 
189
  Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
190
 
191
  <|UTILISATEUR|>: {prompt}
192
+ <|ASSISTANT|>:
193
+
194
  '''
195
 
196
  print("\n\n*** Generate:")
 
201
 
202
  # Inference can also be done using transformers' pipeline
203
 
 
 
 
204
  print("*** Pipeline:")
205
  pipe = pipeline(
206
  "text-generation",
 
214
 
215
  print(pipe(prompt_template)[0]['generated_text'])
216
  ```
217
+ <!-- README_GPTQ.md-use-from-python end -->
218
 
219
+ <!-- README_GPTQ.md-compatibility start -->
220
  ## Compatibility
221
 
222
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
223
+
224
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
225
 
226
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
227
+ <!-- README_GPTQ.md-compatibility end -->
228
 
229
  <!-- footer start -->
230
  <!-- 200823 -->
 
249
 
250
  **Special thanks to**: Aemon Algiz.
251
 
252
+ **Patreon special mentions**: Russ Johnson, J, alfie_i, Alex, NimbleBox.ai, Chadd, Mandus, Nikolai Manek, Ken Nordquist, ya boyyy, Illia Dulskyi, Viktor Bowallius, vamX, Iucharbius, zynix, Magnesian, Clay Pascal, Pierre Kircher, Enrico Ros, Tony Hughes, Elle, Andrey, knownsqashed, Deep Realms, Jerry Meng, Lone Striker, Derek Yates, Pyrater, Mesiah Bishop, James Bentley, Femi Adebogun, Brandon Frisco, SuperWojo, Alps Aficionado, Michael Dempsey, Vitor Caleffi, Will Dee, Edmond Seymore, usrbinkat, LangChain4j, Kacper Wikieł, Luke Pendergrass, John Detwiler, theTransient, Nathan LeClaire, Tiffany J. Kim, biorpg, Eugene Pentland, Stanislav Ovsiannikov, Fred von Graf, terasurfer, Kalila, Dan Guido, Nitin Borwankar, 阿明, Ai Maven, John Villwock, Gabriel Puliatti, Stephen Murray, Asp the Wyvern, danny, Chris Smitley, ReadyPlayerEmma, S_X, Daniel P. Andersen, Olakabola, Jeffrey Morgan, Imad Khwaja, Caitlyn Gatomon, webtim, Alicia Loh, Trenton Dambrowitz, Swaroop Kallakuri, Erik Bjäreholt, Leonard Tan, Spiking Neurons AB, Luke @flexchar, Ajan Kanaga, Thomas Belote, Deo Leter, RoA, Willem Michiel, transmissions 11, subjectnull, Matthew Berman, Joseph William Delisle, David Ziegler, Michael Davis, Johann-Peter Hartmann, Talal Aujan, senxiiz, Artur Olbinski, Rainer Wilmers, Spencer Kim, Fen Risland, Cap'n Zoog, Rishabh Srivastava, Michael Levine, Geoffrey Montalvo, Sean Connelly, Alexandros Triantafyllidis, Pieter, Gabriel Tamborski, Sam, Subspace Studios, Junyu Yang, Pedro Madruga, Vadim, Cory Kujawski, K, Raven Klaugh, Randy H, Mano Prime, Sebastain Graf, Space Cruiser
253
 
254
 
255
  Thank you to all my generous patrons and donaters!
 
262
 
263
 
264
  <p align="center" width="100%">
265
+ <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;">
266
  </p>
267
 
268
+ # Vigogne-2-7B-Chat-V2.0: A Llama-2 based French chat LLM
269
 
270
+ 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.
271
 
272
+ 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.
273
 
274
+ **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).
275
+
276
+ ## Changelog
277
+
278
+ All previous versions are accessible through branches.
279
+
280
+ - **V1.0**: Trained on 420K chat data.
281
+ - **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.
282
 
283
  ## Usage
284
 
285
  ```python
286
  import torch
287
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, TextStreamer
288
  from vigogne.preprocess import generate_inference_chat_prompt
289
 
290
  model_name_or_path = "bofenghuang/vigogne-2-7b-chat"
291
+ revision = "v2.0"
292
+
293
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, revision=revision, padding_side="right", use_fast=False)
294
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path, revision=revision, torch_dtype=torch.float16, device_map="auto")
295
+
296
+ streamer = TextStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
297
+
298
+
299
+ def infer(
300
+ utterances,
301
+ system_message=None,
302
+ temperature=0.1,
303
+ top_p=1.0,
304
+ top_k=0,
305
+ repetition_penalty=1.1,
306
+ max_new_tokens=1024,
307
+ **kwargs,
308
+ ):
309
+ prompt = generate_inference_chat_prompt(utterances, tokenizer, system_message=system_message)
310
+ input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to(model.device)
311
+ input_length = input_ids.shape[1]
312
+
313
+ generated_outputs = model.generate(
314
+ input_ids=input_ids,
315
+ generation_config=GenerationConfig(
316
+ temperature=temperature,
317
+ do_sample=temperature > 0.0,
318
+ top_p=top_p,
319
+ top_k=top_k,
320
+ repetition_penalty=repetition_penalty,
321
+ max_new_tokens=max_new_tokens,
322
+ eos_token_id=tokenizer.eos_token_id,
323
+ pad_token_id=tokenizer.pad_token_id,
324
+ **kwargs,
325
+ ),
326
+ streamer=streamer,
327
+ return_dict_in_generate=True,
328
+ )
329
+ generated_tokens = generated_outputs.sequences[0, input_length:]
330
+ generated_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)
331
+ return generated_text
332
+
333
 
334
  user_query = "Expliquez la différence entre DoS et phishing."
335
+ infer([[user_query, ""]])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  ```
337
 
338
+ You can utilize the Google Colab Notebook below for inferring with the Vigogne chat models.
339
 
340
  <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>
341