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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- Open-Orca/OpenOrca
|
4 |
+
inference: false
|
5 |
+
license: other
|
6 |
+
model_type: llama
|
7 |
+
---
|
8 |
+
|
9 |
+
<!-- header start -->
|
10 |
+
<div style="width: 100%;">
|
11 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
12 |
+
</div>
|
13 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
14 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
15 |
+
<p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
|
16 |
+
</div>
|
17 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
18 |
+
<p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
<!-- header end -->
|
22 |
+
|
23 |
+
# Open-Orca's OpenChat V2 x OpenOrca Preview 2 GPTQ
|
24 |
+
|
25 |
+
These files are GPTQ model files for [Open-Orca's OpenChat V2 x OpenOrca Preview 2](https://huggingface.co/openchat/openchat_v2_openorca_preview).
|
26 |
+
|
27 |
+
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.
|
28 |
+
|
29 |
+
These models were quantised using hardware kindly provided by [Latitude.sh](https://www.latitude.sh/accelerate).
|
30 |
+
|
31 |
+
## Repositories available
|
32 |
+
|
33 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/openchat_v2_openorca_preview-GPTQ)
|
34 |
+
* [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/openchat/openchat_v2_openorca_preview)
|
35 |
+
|
36 |
+
## Prompt template: custom
|
37 |
+
|
38 |
+
```
|
39 |
+
The conversation template involves concatenating tokens, and cannot be expressed in plain-text.
|
40 |
+
|
41 |
+
Besides base model vocabulary, an end-of-turn token <|end_of_turn|> is added.
|
42 |
+
|
43 |
+
Here is an example of single-round conversation template:
|
44 |
+
|
45 |
+
```python
|
46 |
+
def tokenize_single_input(tokenizer, prompt):
|
47 |
+
# OpenChat V2
|
48 |
+
human_prefix = "User:"
|
49 |
+
prefix = "Assistant GPT4:"
|
50 |
+
eot_token = "<|end_of_turn|>"
|
51 |
+
bos_token = "<s>"
|
52 |
+
|
53 |
+
def _tokenize(text):
|
54 |
+
return tokenizer.convert_tokens_to_ids(tokenizer._tokenize(text))
|
55 |
+
|
56 |
+
def _tokenize_special(special_name):
|
57 |
+
return tokenizer.convert_tokens_to_ids(special_name)
|
58 |
+
|
59 |
+
return [_tokenize_special(bos_token)] + _tokenize(human_prefix) + _tokenize(prompt) + [_tokenize_special(eot_token)] + \
|
60 |
+
_tokenize(prefix)
|
61 |
+
```
|
62 |
+
|
63 |
+
To explore conditional language models, you can also set prefix = "Assistant GPT3:" to mimic ChatGPT behavior (this may cause performance degradation).
|
64 |
+
|
65 |
+
Hint: In BPE, tokenize(A) + tokenize(B) does not always equals to tokenize(A + B).
|
66 |
+
|
67 |
+
Due to the custom tokenisation, GGMLs will not be provided.
|
68 |
+
|
69 |
+
```
|
70 |
+
|
71 |
+
## Provided files
|
72 |
+
|
73 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
74 |
+
|
75 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
76 |
+
|
77 |
+
| Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
|
78 |
+
| ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
|
79 |
+
| main | 4 | 128 | False | 7.45 GB | True | GPTQ-for-LLaMa | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
|
80 |
+
| gptq-4bit-32g-actorder_True | 4 | 32 | True | 8.00 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 32g gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
|
81 |
+
| gptq-4bit-64g-actorder_False | 4 | 64 | False | 7.51 GB | True | AutoGPTQ | 4-bit, without Act Order and group size. Without Act Order to improve AutoGPTQ speed, and better accuracy than 128g-False. |
|
82 |
+
| gptq-4bit-64g-actorder_True | 4 | 64 | True | 7.51 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 64g uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
83 |
+
| gptq-4bit-128g-actorder_True | 4 | 128 | True | 7.26 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 128g uses even less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
84 |
+
| gptq-8bit--1g-actorder_True | 8 | None | True | 13.36 GB | False | AutoGPTQ | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
|
85 |
+
| gptq-8bit-128g-actorder_True | 8 | 128 | True | 13.65 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
|
86 |
+
| gptq-8bit-128g-actorder_False | 8 | 128 | False | 13.65 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
|
87 |
+
|
88 |
+
## How to download from branches
|
89 |
+
|
90 |
+
- In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/openchat_v2_openorca_preview-GPTQ:gptq-4bit-32g-actorder_True`
|
91 |
+
- With Git, you can clone a branch with:
|
92 |
+
```
|
93 |
+
git clone --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/openchat_v2_openorca_preview-GPTQ`
|
94 |
+
```
|
95 |
+
- In Python Transformers code, the branch is the `revision` parameter; see below.
|
96 |
+
|
97 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
98 |
+
|
99 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
100 |
+
|
101 |
+
It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
|
102 |
+
|
103 |
+
1. Click the **Model tab**.
|
104 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/openchat_v2_openorca_preview-GPTQ`.
|
105 |
+
- To download from a specific branch, enter for example `TheBloke/openchat_v2_openorca_preview-GPTQ:gptq-4bit-32g-actorder_True`
|
106 |
+
- see Provided Files above for the list of branches for each option.
|
107 |
+
3. Click **Download**.
|
108 |
+
4. The model will start downloading. Once it's finished it will say "Done"
|
109 |
+
5. In the top left, click the refresh icon next to **Model**.
|
110 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `openchat_v2_openorca_preview-GPTQ`
|
111 |
+
7. The model will automatically load, and is now ready for use!
|
112 |
+
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.
|
113 |
+
* Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
|
114 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
115 |
+
|
116 |
+
## How to use this GPTQ model from Python code
|
117 |
+
|
118 |
+
First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
|
119 |
+
|
120 |
+
`GITHUB_ACTIONS=true pip install auto-gptq`
|
121 |
+
|
122 |
+
Then try the following example code:
|
123 |
+
|
124 |
+
```python
|
125 |
+
from transformers import AutoTokenizer, pipeline, logging
|
126 |
+
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
127 |
+
|
128 |
+
model_name_or_path = "TheBloke/openchat_v2_openorca_preview-GPTQ"
|
129 |
+
model_basename = "openorca-openchat-v2-preview2-GPTQ-4bit-128g.no-act.order"
|
130 |
+
|
131 |
+
use_triton = False
|
132 |
+
|
133 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
134 |
+
|
135 |
+
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
|
136 |
+
model_basename=model_basename
|
137 |
+
use_safetensors=True,
|
138 |
+
trust_remote_code=True,
|
139 |
+
device="cuda:0",
|
140 |
+
use_triton=use_triton,
|
141 |
+
quantize_config=None)
|
142 |
+
|
143 |
+
"""
|
144 |
+
To download from a specific branch, use the revision parameter, as in this example:
|
145 |
+
|
146 |
+
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
|
147 |
+
revision="gptq-4bit-32g-actorder_True",
|
148 |
+
model_basename=model_basename,
|
149 |
+
use_safetensors=True,
|
150 |
+
trust_remote_code=True,
|
151 |
+
device="cuda:0",
|
152 |
+
quantize_config=None)
|
153 |
+
"""
|
154 |
+
|
155 |
+
prompt = "Tell me about AI"
|
156 |
+
prompt_template=f'''The conversation template involves concatenating tokens, and cannot be expressed in plain-text.
|
157 |
+
|
158 |
+
Besides base model vocabulary, an end-of-turn token <|end_of_turn|> is added.
|
159 |
+
|
160 |
+
Here is an example of single-round conversation template:
|
161 |
+
|
162 |
+
```python
|
163 |
+
def tokenize_single_input(tokenizer, prompt):
|
164 |
+
# OpenChat V2
|
165 |
+
human_prefix = "User:"
|
166 |
+
prefix = "Assistant GPT4:"
|
167 |
+
eot_token = "<|end_of_turn|>"
|
168 |
+
bos_token = "<s>"
|
169 |
+
|
170 |
+
def _tokenize(text):
|
171 |
+
return tokenizer.convert_tokens_to_ids(tokenizer._tokenize(text))
|
172 |
+
|
173 |
+
def _tokenize_special(special_name):
|
174 |
+
return tokenizer.convert_tokens_to_ids(special_name)
|
175 |
+
|
176 |
+
return [_tokenize_special(bos_token)] + _tokenize(human_prefix) + _tokenize(prompt) + [_tokenize_special(eot_token)] + \
|
177 |
+
_tokenize(prefix)
|
178 |
+
```
|
179 |
+
|
180 |
+
To explore conditional language models, you can also set prefix = "Assistant GPT3:" to mimic ChatGPT behavior (this may cause performance degradation).
|
181 |
+
|
182 |
+
Hint: In BPE, tokenize(A) + tokenize(B) does not always equals to tokenize(A + B).
|
183 |
+
|
184 |
+
Due to the custom tokenisation, GGMLs will not be provided.
|
185 |
+
|
186 |
+
'''
|
187 |
+
|
188 |
+
print("\n\n*** Generate:")
|
189 |
+
|
190 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
191 |
+
output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
|
192 |
+
print(tokenizer.decode(output[0]))
|
193 |
+
|
194 |
+
# Inference can also be done using transformers' pipeline
|
195 |
+
|
196 |
+
# Prevent printing spurious transformers error when using pipeline with AutoGPTQ
|
197 |
+
logging.set_verbosity(logging.CRITICAL)
|
198 |
+
|
199 |
+
print("*** Pipeline:")
|
200 |
+
pipe = pipeline(
|
201 |
+
"text-generation",
|
202 |
+
model=model,
|
203 |
+
tokenizer=tokenizer,
|
204 |
+
max_new_tokens=512,
|
205 |
+
temperature=0.7,
|
206 |
+
top_p=0.95,
|
207 |
+
repetition_penalty=1.15
|
208 |
+
)
|
209 |
+
|
210 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
211 |
+
```
|
212 |
+
|
213 |
+
## Compatibility
|
214 |
+
|
215 |
+
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.
|
216 |
+
|
217 |
+
ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
|
218 |
+
|
219 |
+
<!-- footer start -->
|
220 |
+
## Discord
|
221 |
+
|
222 |
+
For further support, and discussions on these models and AI in general, join us at:
|
223 |
+
|
224 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
225 |
+
|
226 |
+
## Thanks, and how to contribute.
|
227 |
+
|
228 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
229 |
+
|
230 |
+
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.
|
231 |
+
|
232 |
+
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.
|
233 |
+
|
234 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
235 |
+
|
236 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
237 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
238 |
+
|
239 |
+
**Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
|
240 |
+
|
241 |
+
**Patreon special mentions**: Space Cruiser, Nikolai Manek, Sam, Chris McCloskey, Rishabh Srivastava, Kalila, Spiking Neurons AB, Khalefa Al-Ahmad, WelcomeToTheClub, Chadd, Lone Striker, Viktor Bowallius, Edmond Seymore, Ai Maven, Chris Smitley, Dave, Alexandros Triantafyllidis, Luke @flexchar, Elle, ya boyyy, Talal Aujan, Alex , Jonathan Leane, Deep Realms, Randy H, subjectnull, Preetika Verma, Joseph William Delisle, Michael Levine, chris gileta, K, Oscar Rangel, LangChain4j, Trenton Dambrowitz, Eugene Pentland, Johann-Peter Hartmann, Femi Adebogun, Illia Dulskyi, senxiiz, Daniel P. Andersen, Sean Connelly, Artur Olbinski, RoA, Mano Prime, Derek Yates, Raven Klaugh, David Flickinger, Willem Michiel, Pieter, Willian Hasse, vamX, Luke Pendergrass, webtim, Ghost , Rainer Wilmers, Nathan LeClaire, Will Dee, Cory Kujawski, John Detwiler, Fred von Graf, biorpg, Iucharbius , Imad Khwaja, Pierre Kircher, terasurfer , Asp the Wyvern, John Villwock, theTransient, zynix , Gabriel Tamborski, Fen Risland, Gabriel Puliatti, Matthew Berman, Pyrater, SuperWojo, Stephen Murray, Karl Bernard, Ajan Kanaga, Greatston Gnanesh, Junyu Yang.
|
242 |
+
|
243 |
+
Thank you to all my generous patrons and donaters!
|
244 |
+
|
245 |
+
<!-- footer end -->
|
246 |
+
|
247 |
+
# Original model card: Open-Orca's OpenChat V2 x OpenOrca Preview 2
|
248 |
+
|
249 |
+
|
250 |
+
# OpenChat V2 x OpenOrca Preview 2
|
251 |
+
|
252 |
+
This is a preview version of [OpenChat V2](https://github.com/imoneoi/openchat) trained for 2 epochs (total 5 epochs) on full (4.5M) [OpenOrca dataset](https://huggingface.co/datasets/Open-Orca/OpenOrca).
|
253 |
+
|
254 |
+
<div align="center">
|
255 |
+
<img src="https://huggingface.co/openchat/openchat_v2_openorca_preview/resolve/main/logo.png" style="width: 80%">
|
256 |
+
<p></p>
|
257 |
+
<img src="https://huggingface.co/datasets/Open-Orca/OpenOrca/resolve/main/OpenOrcaLogo.png">
|
258 |
+
</div>
|
259 |
+
|
260 |
+
## AGIEval Preliminary Results
|
261 |
+
|
262 |
+
```
|
263 |
+
OpenChat V2 OpenOrca Preview
|
264 |
+
|
265 |
+
name accuracy unmatched
|
266 |
+
aqua-rat.zero-shot 0.232283 0.0
|
267 |
+
logiqa-en.zero-shot 0.370200 0.0
|
268 |
+
lsat-ar.zero-shot 0.230435 0.0
|
269 |
+
lsat-lr.zero-shot 0.441176 0.0
|
270 |
+
lsat-rc.zero-shot 0.568773 0.0
|
271 |
+
sat-en-without-passage.zero-shot 0.393204 0.0
|
272 |
+
sat-en.zero-shot 0.747573 0.0
|
273 |
+
sat-math.zero-shot 0.295455 0.0
|
274 |
+
Average 0.409887 0.0
|
275 |
+
|
276 |
+
AGIEval Average reported in Orca paper: 0.417
|
277 |
+
```
|
278 |
+
|
279 |
+
## Serving
|
280 |
+
|
281 |
+
This model is compatible with [OpenChat V2](https://github.com/imoneoi/openchat) vLLM OpenAI API server. It can be used as a drop-in replacement for OpenChat V2 weights.
|
282 |
+
|
283 |
+
```bash
|
284 |
+
python -m ochat.serving.openai_api_server --model_type openchat_v2 --model openchat/openchat_v2_openorca_preview --engine-use-ray --worker-use-ray
|
285 |
+
```
|
286 |
+
|
287 |
+
## Conversation Template
|
288 |
+
|
289 |
+
The conversation template **involves concatenating tokens**, and cannot be expressed in plain-text.
|
290 |
+
|
291 |
+
Besides base model vocabulary, an end-of-turn token `<|end_of_turn|>` is added.
|
292 |
+
|
293 |
+
Here is an example of single-round conversation template:
|
294 |
+
|
295 |
+
```python
|
296 |
+
def tokenize_single_input(tokenizer, prompt):
|
297 |
+
# OpenChat V2
|
298 |
+
human_prefix = "User:"
|
299 |
+
prefix = "Assistant GPT4:"
|
300 |
+
eot_token = "<|end_of_turn|>"
|
301 |
+
bos_token = "<s>"
|
302 |
+
|
303 |
+
def _tokenize(text):
|
304 |
+
return tokenizer.convert_tokens_to_ids(tokenizer._tokenize(text))
|
305 |
+
|
306 |
+
def _tokenize_special(special_name):
|
307 |
+
return tokenizer.convert_tokens_to_ids(special_name)
|
308 |
+
|
309 |
+
return [_tokenize_special(bos_token)] + _tokenize(human_prefix) + _tokenize(prompt) + [_tokenize_special(eot_token)] + \
|
310 |
+
_tokenize(prefix)
|
311 |
+
```
|
312 |
+
|
313 |
+
To explore conditional language models, you can also set `prefix = "Assistant GPT3:"` to mimic ChatGPT behavior (this may cause performance degradation).
|
314 |
+
|
315 |
+
*Hint: In BPE, `tokenize(A) + tokenize(B)` does not always equals to `tokenize(A + B)`*
|