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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: pansophic/rocket-3B
|
3 |
+
inference: false
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
license: cc-by-sa-4.0
|
7 |
+
model-index:
|
8 |
+
- name: rocket-3b
|
9 |
+
results: []
|
10 |
+
model_creator: pansophic
|
11 |
+
model_name: Rocket 3B
|
12 |
+
model_type: stablelm
|
13 |
+
prompt_template: '<|im_start|>system
|
14 |
+
|
15 |
+
{system_message}<|im_end|>
|
16 |
+
|
17 |
+
<|im_start|>user
|
18 |
+
|
19 |
+
{prompt}<|im_end|>
|
20 |
+
|
21 |
+
<|im_start|>assistant
|
22 |
+
|
23 |
+
'
|
24 |
+
quantized_by: TheBloke
|
25 |
+
---
|
26 |
+
<!-- markdownlint-disable MD041 -->
|
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 |
+
# Rocket 3B - GPTQ
|
46 |
+
- Model creator: [pansophic](https://huggingface.co/pansophic)
|
47 |
+
- Original model: [Rocket 3B](https://huggingface.co/pansophic/rocket-3B)
|
48 |
+
|
49 |
+
<!-- description start -->
|
50 |
+
# Description
|
51 |
+
|
52 |
+
This repo contains GPTQ model files for [pansophic's Rocket 3B](https://huggingface.co/pansophic/rocket-3B).
|
53 |
+
|
54 |
+
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.
|
55 |
+
|
56 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
57 |
+
|
58 |
+
<!-- description end -->
|
59 |
+
<!-- repositories-available start -->
|
60 |
+
## Repositories available
|
61 |
+
|
62 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/rocket-3B-GPTQ)
|
63 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/rocket-3B-GGUF)
|
64 |
+
* [pansophic's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/pansophic/rocket-3B)
|
65 |
+
<!-- repositories-available end -->
|
66 |
+
|
67 |
+
<!-- prompt-template start -->
|
68 |
+
## Prompt template: ChatML
|
69 |
+
|
70 |
+
```
|
71 |
+
<|im_start|>system
|
72 |
+
{system_message}<|im_end|>
|
73 |
+
<|im_start|>user
|
74 |
+
{prompt}<|im_end|>
|
75 |
+
<|im_start|>assistant
|
76 |
+
|
77 |
+
```
|
78 |
+
|
79 |
+
<!-- prompt-template end -->
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
<!-- README_GPTQ.md-compatible clients start -->
|
84 |
+
## Known compatible clients / servers
|
85 |
+
|
86 |
+
These GPTQ models are known to work in the following inference servers/webuis.
|
87 |
+
|
88 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
89 |
+
- [KoboldAI United](https://github.com/henk717/koboldai)
|
90 |
+
- [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
|
91 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
92 |
+
|
93 |
+
This may not be a complete list; if you know of others, please let me know!
|
94 |
+
<!-- README_GPTQ.md-compatible clients end -->
|
95 |
+
|
96 |
+
<!-- README_GPTQ.md-provided-files start -->
|
97 |
+
## Provided files, and GPTQ parameters
|
98 |
+
|
99 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
100 |
+
|
101 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
102 |
+
|
103 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
104 |
+
|
105 |
+
<details>
|
106 |
+
<summary>Explanation of GPTQ parameters</summary>
|
107 |
+
|
108 |
+
- Bits: The bit size of the quantised model.
|
109 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
110 |
+
- 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.
|
111 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
112 |
+
- GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration 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).
|
113 |
+
- 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.
|
114 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
|
115 |
+
|
116 |
+
</details>
|
117 |
+
|
118 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
119 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
120 |
+
| [main](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 1.84 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
|
121 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 1.99 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
122 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 3.06 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
123 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 3.12 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
124 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 3.30 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
|
125 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/rocket-3B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 1.89 GB | No | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
|
126 |
+
|
127 |
+
<!-- README_GPTQ.md-provided-files end -->
|
128 |
+
|
129 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
130 |
+
## How to download, including from branches
|
131 |
+
|
132 |
+
### In text-generation-webui
|
133 |
+
|
134 |
+
To download from the `main` branch, enter `TheBloke/rocket-3B-GPTQ` in the "Download model" box.
|
135 |
+
|
136 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/rocket-3B-GPTQ:gptq-4bit-32g-actorder_True`
|
137 |
+
|
138 |
+
### From the command line
|
139 |
+
|
140 |
+
I recommend using the `huggingface-hub` Python library:
|
141 |
+
|
142 |
+
```shell
|
143 |
+
pip3 install huggingface-hub
|
144 |
+
```
|
145 |
+
|
146 |
+
To download the `main` branch to a folder called `rocket-3B-GPTQ`:
|
147 |
+
|
148 |
+
```shell
|
149 |
+
mkdir rocket-3B-GPTQ
|
150 |
+
huggingface-cli download TheBloke/rocket-3B-GPTQ --local-dir rocket-3B-GPTQ --local-dir-use-symlinks False
|
151 |
+
```
|
152 |
+
|
153 |
+
To download from a different branch, add the `--revision` parameter:
|
154 |
+
|
155 |
+
```shell
|
156 |
+
mkdir rocket-3B-GPTQ
|
157 |
+
huggingface-cli download TheBloke/rocket-3B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir rocket-3B-GPTQ --local-dir-use-symlinks False
|
158 |
+
```
|
159 |
+
|
160 |
+
<details>
|
161 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
162 |
+
|
163 |
+
If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
|
164 |
+
|
165 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
166 |
+
|
167 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
168 |
+
|
169 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
170 |
+
|
171 |
+
```shell
|
172 |
+
pip3 install hf_transfer
|
173 |
+
```
|
174 |
+
|
175 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
176 |
+
|
177 |
+
```shell
|
178 |
+
mkdir rocket-3B-GPTQ
|
179 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/rocket-3B-GPTQ --local-dir rocket-3B-GPTQ --local-dir-use-symlinks False
|
180 |
+
```
|
181 |
+
|
182 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
183 |
+
</details>
|
184 |
+
|
185 |
+
### With `git` (**not** recommended)
|
186 |
+
|
187 |
+
To clone a specific branch with `git`, use a command like this:
|
188 |
+
|
189 |
+
```shell
|
190 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/rocket-3B-GPTQ
|
191 |
+
```
|
192 |
+
|
193 |
+
Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
|
194 |
+
|
195 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
196 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
197 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
198 |
+
|
199 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
200 |
+
|
201 |
+
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.
|
202 |
+
|
203 |
+
1. Click the **Model tab**.
|
204 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/rocket-3B-GPTQ`.
|
205 |
+
|
206 |
+
- To download from a specific branch, enter for example `TheBloke/rocket-3B-GPTQ:gptq-4bit-32g-actorder_True`
|
207 |
+
- see Provided Files above for the list of branches for each option.
|
208 |
+
|
209 |
+
3. Click **Download**.
|
210 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
211 |
+
5. In the top left, click the refresh icon next to **Model**.
|
212 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `rocket-3B-GPTQ`
|
213 |
+
7. The model will automatically load, and is now ready for use!
|
214 |
+
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.
|
215 |
+
|
216 |
+
- 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`.
|
217 |
+
|
218 |
+
9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
219 |
+
|
220 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
221 |
+
|
222 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
223 |
+
## Serving this model from Text Generation Inference (TGI)
|
224 |
+
|
225 |
+
It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
226 |
+
|
227 |
+
Example Docker parameters:
|
228 |
+
|
229 |
+
```shell
|
230 |
+
--model-id TheBloke/rocket-3B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
231 |
+
```
|
232 |
+
|
233 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
234 |
+
|
235 |
+
```shell
|
236 |
+
pip3 install huggingface-hub
|
237 |
+
```
|
238 |
+
|
239 |
+
```python
|
240 |
+
from huggingface_hub import InferenceClient
|
241 |
+
|
242 |
+
endpoint_url = "https://your-endpoint-url-here"
|
243 |
+
|
244 |
+
prompt = "Tell me about AI"
|
245 |
+
prompt_template=f'''<|im_start|>system
|
246 |
+
{system_message}<|im_end|>
|
247 |
+
<|im_start|>user
|
248 |
+
{prompt}<|im_end|>
|
249 |
+
<|im_start|>assistant
|
250 |
+
'''
|
251 |
+
|
252 |
+
client = InferenceClient(endpoint_url)
|
253 |
+
response = client.text_generation(prompt,
|
254 |
+
max_new_tokens=128,
|
255 |
+
do_sample=True,
|
256 |
+
temperature=0.7,
|
257 |
+
top_p=0.95,
|
258 |
+
top_k=40,
|
259 |
+
repetition_penalty=1.1)
|
260 |
+
|
261 |
+
print(f"Model output: {response}")
|
262 |
+
```
|
263 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
264 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
265 |
+
## Python code example: inference from this GPTQ model
|
266 |
+
|
267 |
+
### Install the necessary packages
|
268 |
+
|
269 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
270 |
+
|
271 |
+
```shell
|
272 |
+
pip3 install --upgrade transformers optimum
|
273 |
+
# If using PyTorch 2.1 + CUDA 12.x:
|
274 |
+
pip3 install --upgrade auto-gptq
|
275 |
+
# or, if using PyTorch 2.1 + CUDA 11.x:
|
276 |
+
pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
|
277 |
+
```
|
278 |
+
|
279 |
+
If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:
|
280 |
+
|
281 |
+
```shell
|
282 |
+
pip3 uninstall -y auto-gptq
|
283 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
284 |
+
cd AutoGPTQ
|
285 |
+
git checkout v0.5.1
|
286 |
+
pip3 install .
|
287 |
+
```
|
288 |
+
|
289 |
+
### Example Python code
|
290 |
+
|
291 |
+
```python
|
292 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
293 |
+
|
294 |
+
model_name_or_path = "TheBloke/rocket-3B-GPTQ"
|
295 |
+
# To use a different branch, change revision
|
296 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
297 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
298 |
+
device_map="auto",
|
299 |
+
trust_remote_code=True,
|
300 |
+
revision="main")
|
301 |
+
|
302 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
303 |
+
|
304 |
+
prompt = "Tell me about AI"
|
305 |
+
prompt_template=f'''<|im_start|>system
|
306 |
+
{system_message}<|im_end|>
|
307 |
+
<|im_start|>user
|
308 |
+
{prompt}<|im_end|>
|
309 |
+
<|im_start|>assistant
|
310 |
+
'''
|
311 |
+
|
312 |
+
print("\n\n*** Generate:")
|
313 |
+
|
314 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
315 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
316 |
+
print(tokenizer.decode(output[0]))
|
317 |
+
|
318 |
+
# Inference can also be done using transformers' pipeline
|
319 |
+
|
320 |
+
print("*** Pipeline:")
|
321 |
+
pipe = pipeline(
|
322 |
+
"text-generation",
|
323 |
+
model=model,
|
324 |
+
tokenizer=tokenizer,
|
325 |
+
max_new_tokens=512,
|
326 |
+
do_sample=True,
|
327 |
+
temperature=0.7,
|
328 |
+
top_p=0.95,
|
329 |
+
top_k=40,
|
330 |
+
repetition_penalty=1.1
|
331 |
+
)
|
332 |
+
|
333 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
334 |
+
```
|
335 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
336 |
+
|
337 |
+
<!-- README_GPTQ.md-compatibility start -->
|
338 |
+
## Compatibility
|
339 |
+
|
340 |
+
The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
|
341 |
+
|
342 |
+
[ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
|
343 |
+
|
344 |
+
For a list of clients/servers, please see "Known compatible clients / servers", above.
|
345 |
+
<!-- README_GPTQ.md-compatibility end -->
|
346 |
+
|
347 |
+
<!-- footer start -->
|
348 |
+
<!-- 200823 -->
|
349 |
+
## Discord
|
350 |
+
|
351 |
+
For further support, and discussions on these models and AI in general, join us at:
|
352 |
+
|
353 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
354 |
+
|
355 |
+
## Thanks, and how to contribute
|
356 |
+
|
357 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
358 |
+
|
359 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
360 |
+
|
361 |
+
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.
|
362 |
+
|
363 |
+
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.
|
364 |
+
|
365 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
366 |
+
|
367 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
368 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
369 |
+
|
370 |
+
**Special thanks to**: Aemon Algiz.
|
371 |
+
|
372 |
+
**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
|
373 |
+
|
374 |
+
|
375 |
+
Thank you to all my generous patrons and donaters!
|
376 |
+
|
377 |
+
And thank you again to a16z for their generous grant.
|
378 |
+
|
379 |
+
<!-- footer end -->
|
380 |
+
|
381 |
+
# Original model card: pansophic's Rocket 3B
|
382 |
+
|
383 |
+
|
384 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/6501bfe0493fd9c8c2e32402/BmbkjOkcTm-YMa-unolmJ.png" alt="Rocket Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
385 |
+
|
386 |
+
# Rocket-3B 🦝
|
387 |
+
<b>Rocket</b> 🦝 is a 3 billion large language model that was trained on a mix of publicly available datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290). The prompt format used is <b>ChatML</b>.
|
388 |
+
|
389 |
+
|
390 |
+
## Model description
|
391 |
+
- **Model type:** A 3B parameter GPT-like model fine-tuned on a mix of publicly available datasets using DPO.
|
392 |
+
- **Language(s) (NLP):** Primarily English
|
393 |
+
- **License:** CC-BY-SA-4.0
|
394 |
+
- **Finetuned from model:** [Stability AI](https://huggingface.co/stabilityai/stablelm-3b-4e1t)
|
395 |
+
|
396 |
+
|
397 |
+
## Performance
|
398 |
+
Despite its compact dimensions, the model achieves outstanding scores in both MT-Bench [MT-Bench](https://huggingface.co/spaces/lmsys/mt-bench) and [AlpacaEval](https://tatsu-lab.github.io/alpaca_eval/) benchmarks, surpassing the performance of considerably larger models.
|
399 |
+
|
400 |
+
| Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
|
401 |
+
|-------------|-----|----|---------------|--------------|
|
402 |
+
| StableLM-Tuned-α 🦜| 7B | SFT |2.75| -|
|
403 |
+
| MPT-Chat | 7B | SFT |5.42| -|
|
404 |
+
| Falcon-Instruct 🦅| 40B | SFT |5.17 |45.71|
|
405 |
+
| Orca-2| 13B | SFT |6.15 |-|
|
406 |
+
| Xwin-LMv0.1 | 7B| PPO | 6.19| 87.83|
|
407 |
+
| Llama2-Chat 🦙| 7B |RLHF |6.26| 71.37|
|
408 |
+
| TÜLU 2 🐫| 7B | DPO |6.27| 85.1|
|
409 |
+
| Guanaco 🦙| 65B | SFT |6.41| 71.80|
|
410 |
+
| **Rocket** 🦝 | **3B** | **DPO** | **6.56** | **79.75** |
|
411 |
+
| Llama2-Chat 🦙| 13B |RLHF |6.65| 81.09|
|
412 |
+
| Zephyr-7b-α 🪁 |7B| DPO| 6.88| -|
|
413 |
+
| Vicuna v1.3 🦙| 33B | SFT |7.12 |88.99|
|
414 |
+
| Zephyr-7b-β 🪁 |7B| DPO| 7.34| 90.60|
|
415 |
+
| WizardLM v1.0 🦙| 70B |SFT |7.71 |-|
|
416 |
+
| GPT-3.5-turbo | - |RLHF |7.94 |89.37|
|
417 |
+
|
418 |
+
Specifically, across various categories within the MT-Bench evaluation, Rocket-3B demonstrates impressive performance when compared to larger open models such as Llama2-Chat-7B, Falcon-40B-Instruct, and Guanaco-65B.
|
419 |
+
|
420 |
+
|
421 |
+
![MT-Bench results](https://cdn-uploads.huggingface.co/production/uploads/6501bfe0493fd9c8c2e32402/5Tv4-4w4zNKAAjiLNGu7A.png)
|
422 |
+
|
423 |
+
## MT-Bench detailed score for first and second turn
|
424 |
+
In MT-Bench, Rocket 🦝 scores 6.99 in the first turn and 6.13 in the second turn, with an average score of 6.56. These scores reflect the model's performance in understanding and generating text during different parts of a conversation.
|
425 |
+
|
426 |
+
| Model | First turn | Second turn | Average |
|
427 |
+
|-------------|-----|----|---------------|
|
428 |
+
| **Rocket** 🦝 | **6.99** | **6.13** | **6.56** |
|
429 |
+
|
430 |
+
|
431 |
+
## AlpacaEval detailed scores
|
432 |
+
In AlpacaEval, Rocket 🦝 achieves a near 80% win rate, coupled with an average response length of 1,242 tokens, indicating its effectiveness in producing detailed responses.
|
433 |
+
|
434 |
+
| Model | Win rate | Std error | Average length |
|
435 |
+
|-------------|-----|----|---------------|
|
436 |
+
| **Rocket** 🦝 | **79.75** | **1.42** | **1242** |
|
437 |
+
|
438 |
+
|
439 |
+
## Other benchmarks
|
440 |
+
|
441 |
+
| Metric | Value |
|
442 |
+
|-----------------------|---------------------------|
|
443 |
+
| ARC (25-shot) | 50.51 |
|
444 |
+
| HellaSwag (0-shot) | 73.91 |
|
445 |
+
| TruthfulQA (mc2) (0-shot) | 54.38 |
|
446 |
+
| BoolQ (0-shot) | 81.71 |
|
447 |
+
| Winogrande (5-shot) | 67.8 |
|
448 |
+
| GSM8K (5-shot) | 37.91 |
|
449 |
+
| MathQA (5-shot) | 31.26 |
|
450 |
+
|
451 |
+
|
452 |
+
## Intended uses & limitations
|
453 |
+
Initially, we fine-tuned the model using a dataset created by merging and curating multiple datasets, available on the HuggingFace Hub. This dataset will be released to the public soon. We further enhanced the model's performance using DPO, selecting samples from the [openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) and [BAAI/JudgeLM-100K](https://huggingface.co/datasets/BAAI/JudgeLM-100K) datasets. The outcome is a highly effective chat model with a 3 billion parameter scale.
|
454 |
+
|
455 |
+
|
456 |
+
## Input Format
|
457 |
+
The model is trained with the ChatML format:
|
458 |
+
|
459 |
+
```
|
460 |
+
<|im_start|>system
|
461 |
+
System message here.<|im_end|>
|
462 |
+
<|im_start|>user
|
463 |
+
Your message here!<|im_end|>
|
464 |
+
<|im_start|>assistant
|
465 |
+
```
|
466 |
+
|
467 |
+
Here's how you can run the model using 🤗 Transformers:
|
468 |
+
|
469 |
+
```python
|
470 |
+
import torch
|
471 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
472 |
+
|
473 |
+
model = AutoModelForCausalLM.from_pretrained("pansophic/rocket-3B", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")
|
474 |
+
tokenizer = AutoTokenizer.from_pretrained("pansophic/rocket-3B", trust_remote_code=True, torch_dtype=torch.bfloat16)
|
475 |
+
streamer = TextStreamer(tokenizer)
|
476 |
+
|
477 |
+
prompt = """<|im_start|>system
|
478 |
+
{system}<|im_end|>
|
479 |
+
<|im_start|>user
|
480 |
+
{user}<|im_end|>
|
481 |
+
<|im_start|>assistant
|
482 |
+
"""
|
483 |
+
|
484 |
+
system = "You are a helpful assistant."
|
485 |
+
user = "How are you?"
|
486 |
+
|
487 |
+
# Apply the ChatML format
|
488 |
+
prompt = prompt.format(system=system, user=user)
|
489 |
+
|
490 |
+
# Tokenize the prompt
|
491 |
+
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to("cuda")
|
492 |
+
generated_text = model.generate(**inputs, max_length=3084, top_p=0.95, do_sample=True, temperature=0.7, use_cache=True, streamer=streamer)
|
493 |
+
|
494 |
+
# <|im_start|>system
|
495 |
+
# You are a chef who makes everything sound like a secret culinary masterpiece, even everyday meals.<|im_end|>
|
496 |
+
# <|im_start|>user
|
497 |
+
# How to cook an omelette?<|im_end|>
|
498 |
+
# <|im_start|>assistant
|
499 |
+
# Ah, the art of crafting the perfect omelette, a secret culinary masterpiece indeed.
|
500 |
+
# Begin by gently whisking two to three eggs in a mixing bowl, and then pour the silky liquid into a non-stick pan.
|
501 |
+
# Allow the eggs to dance and sizzle as you swiftly tilt the pan to spread the joy throughout the entire omelette universe.
|
502 |
+
# As the edges begin to set, fold the omelette in half with a gentle flourish, and you'll witness a stunning display of culinary prowess.
|
503 |
+
# Enjoy this enchanting creation, and you'll be transported to a world of secret culinary mastery.<|im_end|>
|
504 |
+
```
|
505 |
+
|
506 |
+
## Bias, Risks, and Limitations
|
507 |
+
Unlike ChatGPT, which incorporates in-the-loop filtering of responses and is aligned during the RLHF phase for safe completions, our model lacks these features. Consequently, it may generate problematic outputs, particularly when prompted in certain ways. Below is the score of the model on Toxigen benchmark.
|
508 |
+
|
509 |
+
The pretraining dataset is comprised of a filtered mixture of open-source large-scale datasets available on the [HuggingFace Hub](https://huggingface.co/datasets): Falcon RefinedWeb extract ([Penedo et al., 2023](https://huggingface.co/datasets/tiiuae/falcon-refinedweb)), RedPajama-Data ([Together Computer., 2023](https://github.com/togethercomputer/RedPajama-Data)) and The Pile ([Gao et al., 2020](https://arxiv.org/abs/2101.00027)) both without the *Books3* subset, and StarCoder ([Li et al., 2023](https://arxiv.org/abs/2305.06161)).
|
510 |
+
|
511 |
+
| Metric | Value |
|
512 |
+
|-----------------------|---------------------------|
|
513 |
+
| Toxigen (0-shot) | 43.40 |
|
514 |
+
|
515 |
+
**The model name is inspired by the small but formidable character from 'Guardians of the Galaxy'. Similar to its namesake, this model, with its 3 billion parameters, showcases remarkable efficiency and effectiveness, challenging larger models despite its smaller size."*
|
516 |
+
|
517 |
+
*Model card adapted from [Zephyr Beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta/blob/main/README.md) and [Tulu-2-7B](https://huggingface.co/allenai/tulu-2-7b/blob/main/README.md)*
|