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|
+
library_name: transformers
|
9 |
+
license: cc-by-nc-4.0
|
10 |
+
model_creator: Ray Hernandez
|
11 |
+
model_name: Starling LM Alpha 8X7B MoE
|
12 |
+
model_type: mixtral
|
13 |
+
prompt_template: 'GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:
|
14 |
+
|
15 |
+
'
|
16 |
+
quantized_by: TheBloke
|
17 |
+
tags:
|
18 |
+
- reward model
|
19 |
+
- RLHF
|
20 |
+
- RLAIF
|
21 |
+
---
|
22 |
+
<!-- markdownlint-disable MD041 -->
|
23 |
+
|
24 |
+
<!-- header start -->
|
25 |
+
<!-- 200823 -->
|
26 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
27 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
28 |
+
</div>
|
29 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
30 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
31 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
32 |
+
</div>
|
33 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
34 |
+
<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>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
<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>
|
38 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
39 |
+
<!-- header end -->
|
40 |
+
|
41 |
+
# Starling LM Alpha 8X7B MoE - GPTQ
|
42 |
+
- Model creator: [Ray Hernandez](https://huggingface.co/perlthoughts)
|
43 |
+
- Original model: [Starling LM Alpha 8X7B MoE](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE)
|
44 |
+
|
45 |
+
<!-- description start -->
|
46 |
+
# Description
|
47 |
+
|
48 |
+
This repo contains GPTQ model files for [Ray Hernandez's Starling LM Alpha 8X7B MoE](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE).
|
49 |
+
|
50 |
+
Mixtral GPTQs currently require:
|
51 |
+
* Transformers 4.36.0 or later
|
52 |
+
* either, AutoGPTQ 0.6 compiled from source, or
|
53 |
+
* Transformers 4.37.0.dev0 compiled from Github with: `pip3 install git+https://github.com/huggingface/transformers`
|
54 |
+
|
55 |
+
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.
|
56 |
+
|
57 |
+
<!-- description end -->
|
58 |
+
<!-- repositories-available start -->
|
59 |
+
## Repositories available
|
60 |
+
|
61 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ)
|
62 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF)
|
63 |
+
* [Ray Hernandez's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE)
|
64 |
+
<!-- repositories-available end -->
|
65 |
+
|
66 |
+
<!-- prompt-template start -->
|
67 |
+
## Prompt template: OpenChat-Correct
|
68 |
+
|
69 |
+
```
|
70 |
+
GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:
|
71 |
+
|
72 |
+
```
|
73 |
+
|
74 |
+
<!-- prompt-template end -->
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
<!-- README_GPTQ.md-compatible clients start -->
|
79 |
+
## Known compatible clients / servers
|
80 |
+
|
81 |
+
GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.
|
82 |
+
|
83 |
+
Mixtral GPTQs currently have special requirements - see Description above.
|
84 |
+
|
85 |
+
<!-- README_GPTQ.md-compatible clients end -->
|
86 |
+
|
87 |
+
<!-- README_GPTQ.md-provided-files start -->
|
88 |
+
## Provided files, and GPTQ parameters
|
89 |
+
|
90 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
91 |
+
|
92 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
93 |
+
|
94 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
95 |
+
|
96 |
+
<details>
|
97 |
+
<summary>Explanation of GPTQ parameters</summary>
|
98 |
+
|
99 |
+
- Bits: The bit size of the quantised model.
|
100 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
101 |
+
- 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.
|
102 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
103 |
+
- 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).
|
104 |
+
- 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.
|
105 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
|
106 |
+
|
107 |
+
</details>
|
108 |
+
|
109 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
110 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
111 |
+
| main | 4 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 23.81 GB | No | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
|
112 |
+
| gptq-4bit-128g-actorder_True | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 24.70 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
|
113 |
+
| gptq-4bit-32g-actorder_True | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 27.42 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
114 |
+
| gptq-3bit--1g-actorder_True | 3 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.01 GB | No | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
|
115 |
+
| gptq-3bit-128g-actorder_True | 3 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.85 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
|
116 |
+
| gptq-3bit-32g-actorder_True | 3 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 21.43 GB | No | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. |
|
117 |
+
| gptq-8bit--1g-actorder_True | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 47.04 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
118 |
+
| gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 48.10 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
119 |
+
|
120 |
+
<!-- README_GPTQ.md-provided-files end -->
|
121 |
+
|
122 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
123 |
+
## How to download, including from branches
|
124 |
+
|
125 |
+
### In text-generation-webui
|
126 |
+
|
127 |
+
To download from the `main` branch, enter `TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ` in the "Download model" box.
|
128 |
+
|
129 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ:gptq-4bit-128g-actorder_True`
|
130 |
+
|
131 |
+
### From the command line
|
132 |
+
|
133 |
+
I recommend using the `huggingface-hub` Python library:
|
134 |
+
|
135 |
+
```shell
|
136 |
+
pip3 install huggingface-hub
|
137 |
+
```
|
138 |
+
|
139 |
+
To download the `main` branch to a folder called `Starling-LM-alpha-8x7B-MoE-GPTQ`:
|
140 |
+
|
141 |
+
```shell
|
142 |
+
mkdir Starling-LM-alpha-8x7B-MoE-GPTQ
|
143 |
+
huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ --local-dir Starling-LM-alpha-8x7B-MoE-GPTQ --local-dir-use-symlinks False
|
144 |
+
```
|
145 |
+
|
146 |
+
To download from a different branch, add the `--revision` parameter:
|
147 |
+
|
148 |
+
```shell
|
149 |
+
mkdir Starling-LM-alpha-8x7B-MoE-GPTQ
|
150 |
+
huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir Starling-LM-alpha-8x7B-MoE-GPTQ --local-dir-use-symlinks False
|
151 |
+
```
|
152 |
+
|
153 |
+
<details>
|
154 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
155 |
+
|
156 |
+
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.
|
157 |
+
|
158 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
159 |
+
|
160 |
+
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).
|
161 |
+
|
162 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
163 |
+
|
164 |
+
```shell
|
165 |
+
pip3 install hf_transfer
|
166 |
+
```
|
167 |
+
|
168 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
169 |
+
|
170 |
+
```shell
|
171 |
+
mkdir Starling-LM-alpha-8x7B-MoE-GPTQ
|
172 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ --local-dir Starling-LM-alpha-8x7B-MoE-GPTQ --local-dir-use-symlinks False
|
173 |
+
```
|
174 |
+
|
175 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
176 |
+
</details>
|
177 |
+
|
178 |
+
### With `git` (**not** recommended)
|
179 |
+
|
180 |
+
To clone a specific branch with `git`, use a command like this:
|
181 |
+
|
182 |
+
```shell
|
183 |
+
git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ
|
184 |
+
```
|
185 |
+
|
186 |
+
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.)
|
187 |
+
|
188 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
189 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
190 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
191 |
+
|
192 |
+
**NOTE**: Requires:
|
193 |
+
|
194 |
+
* Transformers 4.36.0, or Transformers 4.37.0.dev0 from Github
|
195 |
+
* Either AutoGPTQ 0.6 compiled from source and `Loader: AutoGPTQ`,
|
196 |
+
* or, `Loader: Transformers`, if you installed Transformers from Github: `pip3 install git+https://github.com/huggingface/transformers`
|
197 |
+
|
198 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
199 |
+
|
200 |
+
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.
|
201 |
+
|
202 |
+
1. Click the **Model tab**.
|
203 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ`.
|
204 |
+
|
205 |
+
- To download from a specific branch, enter for example `TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ:gptq-4bit-128g-actorder_True`
|
206 |
+
- see Provided Files above for the list of branches for each option.
|
207 |
+
|
208 |
+
3. Click **Download**.
|
209 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
210 |
+
5. In the top left, click the refresh icon next to **Model**.
|
211 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `Starling-LM-alpha-8x7B-MoE-GPTQ`
|
212 |
+
7. The model will automatically load, and is now ready for use!
|
213 |
+
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.
|
214 |
+
|
215 |
+
- 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`.
|
216 |
+
|
217 |
+
9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
218 |
+
|
219 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
220 |
+
|
221 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
222 |
+
## Serving this model from Text Generation Inference (TGI)
|
223 |
+
|
224 |
+
Not currently supported for Mixtral models.
|
225 |
+
|
226 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
227 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
228 |
+
## Python code example: inference from this GPTQ model
|
229 |
+
|
230 |
+
### Install the necessary packages
|
231 |
+
|
232 |
+
Requires: Transformers 4.37.0.dev0 from Github, Optimum 1.16.0 or later, and AutoGPTQ 0.5.1 or later.
|
233 |
+
|
234 |
+
```shell
|
235 |
+
pip3 install --upgrade "git+https://github.com/huggingface/transformers" optimum
|
236 |
+
# If using PyTorch 2.1 + CUDA 12.x:
|
237 |
+
pip3 install --upgrade auto-gptq
|
238 |
+
# or, if using PyTorch 2.1 + CUDA 11.x:
|
239 |
+
pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
|
240 |
+
```
|
241 |
+
|
242 |
+
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:
|
243 |
+
|
244 |
+
```shell
|
245 |
+
pip3 uninstall -y auto-gptq
|
246 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
247 |
+
cd AutoGPTQ
|
248 |
+
DISABLE_QIGEN=1 pip3 install .
|
249 |
+
```
|
250 |
+
|
251 |
+
### Example Python code
|
252 |
+
|
253 |
+
```python
|
254 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
255 |
+
|
256 |
+
model_name_or_path = "TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ"
|
257 |
+
# To use a different branch, change revision
|
258 |
+
# For example: revision="gptq-4bit-128g-actorder_True"
|
259 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
260 |
+
device_map="auto",
|
261 |
+
trust_remote_code=False,
|
262 |
+
revision="main")
|
263 |
+
|
264 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
265 |
+
|
266 |
+
prompt = "Write a story about llamas"
|
267 |
+
system_message = "You are a story writing assistant"
|
268 |
+
prompt_template=f'''GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:
|
269 |
+
'''
|
270 |
+
|
271 |
+
print("\n\n*** Generate:")
|
272 |
+
|
273 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
274 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
275 |
+
print(tokenizer.decode(output[0]))
|
276 |
+
|
277 |
+
# Inference can also be done using transformers' pipeline
|
278 |
+
|
279 |
+
print("*** Pipeline:")
|
280 |
+
pipe = pipeline(
|
281 |
+
"text-generation",
|
282 |
+
model=model,
|
283 |
+
tokenizer=tokenizer,
|
284 |
+
max_new_tokens=512,
|
285 |
+
do_sample=True,
|
286 |
+
temperature=0.7,
|
287 |
+
top_p=0.95,
|
288 |
+
top_k=40,
|
289 |
+
repetition_penalty=1.1
|
290 |
+
)
|
291 |
+
|
292 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
293 |
+
```
|
294 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
295 |
+
|
296 |
+
<!-- README_GPTQ.md-compatibility start -->
|
297 |
+
## Compatibility
|
298 |
+
|
299 |
+
The files provided are tested to work with AutoGPTQ 0.6 (compiled from source) and Transformers 4.37.0 (installed from Github).
|
300 |
+
|
301 |
+
<!-- README_GPTQ.md-compatibility end -->
|
302 |
+
|
303 |
+
<!-- footer start -->
|
304 |
+
<!-- 200823 -->
|
305 |
+
## Discord
|
306 |
+
|
307 |
+
For further support, and discussions on these models and AI in general, join us at:
|
308 |
+
|
309 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
310 |
+
|
311 |
+
## Thanks, and how to contribute
|
312 |
+
|
313 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
314 |
+
|
315 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
316 |
+
|
317 |
+
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.
|
318 |
+
|
319 |
+
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.
|
320 |
+
|
321 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
322 |
+
|
323 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
324 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
325 |
+
|
326 |
+
**Special thanks to**: Aemon Algiz.
|
327 |
+
|
328 |
+
**Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
|
329 |
+
|
330 |
+
|
331 |
+
Thank you to all my generous patrons and donaters!
|
332 |
+
|
333 |
+
And thank you again to a16z for their generous grant.
|
334 |
+
|
335 |
+
<!-- footer end -->
|
336 |
+
|
337 |
+
# Original model card: Ray Hernandez's Starling LM Alpha 8X7B MoE
|
338 |
+
|
339 |
+
|
340 |
+
# Starling-LM-alpha-8x7B-MoE
|
341 |
+
|
342 |
+
Starling MoE 8x7B model.
|
343 |
+
|
344 |
+
# Original Model Card
|
345 |
+
|
346 |
+
# Starling-RM-7B-alpha
|
347 |
+
|
348 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
349 |
+
|
350 |
+
- **Developed by:** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu and Jiantao Jiao.
|
351 |
+
- **Model type:** Language Model finetuned with RLHF / RLAIF
|
352 |
+
- **License:** Non commercial license
|
353 |
+
- **Finetuned from model:** [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5) (based on [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1))
|
354 |
+
|
355 |
+
|
356 |
+
|
357 |
+
We introduce Starling-7B, an open large language model (LLM) trained by Reinforcement Learning from AI Feedback (RLAIF). The model harnesses the power of our new GPT-4 labeled ranking dataset, [berkeley-nest/Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), and our new reward training and policy tuning pipeline. Starling-7B-alpha scores 8.09 in MT Bench with GPT-4 as a judge, outperforming every model to date on MT-Bench except for OpenAI's GPT-4 and GPT-4 Turbo. We release the ranking dataset [Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), the reward model [Starling-RM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-RM-7B-alpha) and the language model [Starling-LM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-LM-7B-alpha) on HuggingFace, and an online demo in LMSYS [Chatbot Arena](https://chat.lmsys.org). Stay tuned for our forthcoming code and paper, which will provide more details on the whole process.
|
358 |
+
|
359 |
+
Starling-LM-7B-alpha is a language model trained from [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5) with reward model [berkeley-nest/Starling-RM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-RM-7B-alpha) and policy optimization method [advantage-induced policy alignment (APA)](https://arxiv.org/abs/2306.02231). The evaluation results are listed below.
|
360 |
+
|
361 |
+
|
362 |
+
| Model | Tuning Method | MT Bench | AlpacaEval | MMLU |
|
363 |
+
|-----------------------|------------------|----------|------------|------|
|
364 |
+
| GPT-4-Turbo | ? | 9.32 | 97.70 | |
|
365 |
+
| GPT-4 | SFT + PPO | 8.99 | 95.28 | 86.4 |
|
366 |
+
| **Starling-7B** | C-RLFT + APA | 8.09 | 91.99 | 63.9 |
|
367 |
+
| Claude-2 | ? | 8.06 | 91.36 | 78.5 |
|
368 |
+
| GPT-3.5-Turbo | ? | 7.94 | 89.37 | 70 |
|
369 |
+
| Claude-1 | ? | 7.9 | 88.39 | 77 |
|
370 |
+
| Tulu-2-dpo-70b | SFT + DPO | 7.89 | 95.1 | |
|
371 |
+
| Openchat-3.5 | C-RLFT | 7.81 | 88.51 | 64.3 |
|
372 |
+
| Zephyr-7B-beta | SFT + DPO | 7.34 | 90.60 | 61.4 |
|
373 |
+
| Llama-2-70b-chat-hf | SFT + PPO | 6.86 | 92.66 | 63 |
|
374 |
+
| Neural-chat-7b-v3-1 | SFT + DPO | 6.84 | 84.53 | 62.4 |
|
375 |
+
| Tulu-2-dpo-7b | SFT + DPO | 6.29 | 85.1 | |
|
376 |
+
|
377 |
+
|
378 |
+
|
379 |
+
For more detailed discussions, please check out our [blog post](https://starling.cs.berkeley.edu), and stay tuned for our upcoming code and paper!
|
380 |
+
<!-- Provide the basic links for the model. -->
|
381 |
+
|
382 |
+
- **Blog:** https://starling.cs.berkeley.edu/
|
383 |
+
- **Paper:** Coming soon!
|
384 |
+
- **Code:** Coming soon!
|
385 |
+
|
386 |
+
|
387 |
+
|
388 |
+
## Uses
|
389 |
+
|
390 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
391 |
+
|
392 |
+
**Important: Please use the exact chat template provided below for the model. Otherwise there will be a degrade in the performance. The model output can be verbose in rare cases. Please consider setting temperature = 0 to make this happen less.**
|
393 |
+
|
394 |
+
Our model follows the exact chat template and usage as [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5). Please refer to their model card for more details.
|
395 |
+
In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
|
396 |
+
|
397 |
+
The conversation template is the same as Openchat 3.5:
|
398 |
+
```
|
399 |
+
import transformers
|
400 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat_3.5")
|
401 |
+
|
402 |
+
# Single-turn
|
403 |
+
tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
|
404 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
405 |
+
|
406 |
+
# Multi-turn
|
407 |
+
tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:").input_ids
|
408 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
409 |
+
|
410 |
+
# Coding Mode
|
411 |
+
tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
|
412 |
+
assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
|
413 |
+
```
|
414 |
+
## Code Examples
|
415 |
+
|
416 |
+
```python
|
417 |
+
import transformers
|
418 |
+
|
419 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
|
420 |
+
model = transformers.AutoModelForCausalLM.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
|
421 |
+
|
422 |
+
def generate_response(prompt):
|
423 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
424 |
+
outputs = model.generate(
|
425 |
+
input_ids,
|
426 |
+
max_length=256,
|
427 |
+
pad_token_id=tokenizer.pad_token_id,
|
428 |
+
eos_token_id=tokenizer.eos_token_id,
|
429 |
+
)
|
430 |
+
response_ids = outputs[0]
|
431 |
+
response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
|
432 |
+
return response_text
|
433 |
+
|
434 |
+
# Single-turn conversation
|
435 |
+
prompt = "Hello, how are you?"
|
436 |
+
single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
|
437 |
+
response_text = generate_response(single_turn_prompt)
|
438 |
+
print("Response:", response_text)
|
439 |
+
|
440 |
+
## Multi-turn conversation
|
441 |
+
prompt = "Hello"
|
442 |
+
follow_up_question = "How are you today?"
|
443 |
+
response = ""
|
444 |
+
multi_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant: {response}<|end_of_turn|>GPT4 Correct User: {follow_up_question}<|end_of_turn|>GPT4 Correct Assistant:"
|
445 |
+
response_text = generate_response(multi_turn_prompt)
|
446 |
+
print("Multi-turn conversation response:", response_text)
|
447 |
+
|
448 |
+
### Coding conversation
|
449 |
+
prompt = "Implement quicksort using C++"
|
450 |
+
coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
|
451 |
+
response = generate_response(coding_prompt)
|
452 |
+
print("Coding conversation response:", response)
|
453 |
+
```
|
454 |
+
|
455 |
+
## License
|
456 |
+
The dataset, model and online demo is a research preview intended for non-commercial use only, subject to the data distillation [License](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) of LLaMA, [Terms of Use](https://openai.com/policies/terms-of-use) of the data generated by OpenAI, and [Privacy Practices](https://chrome.google.com/webstore/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. Please contact us if you find any potential violation.
|
457 |
+
|
458 |
+
|
459 |
+
## Acknowledgment
|
460 |
+
We would like to thank Wei-Lin Chiang from Berkeley for detailed feedback of the blog and the projects. We would like to thank the [LMSYS Organization](https://lmsys.org/) for their support of [lmsys-chat-1M](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) dataset, evaluation and online demo. We would like to thank the open source community for their efforts in providing the datasets and base models we used to develope the project, including but not limited to Anthropic, Llama, Mistral, Hugging Face H4, LMSYS, OpenChat, OpenBMB, Flan and ShareGPT.
|
461 |
+
|
462 |
+
## Citation
|
463 |
+
```
|
464 |
+
@misc{starling2023,
|
465 |
+
title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
|
466 |
+
url = {},
|
467 |
+
author = {Zhu, Banghua and Frick, Evan and Wu, Tianhao and Zhu, Hanlin and Jiao, Jiantao},
|
468 |
+
month = {November},
|
469 |
+
year = {2023}
|
470 |
+
}
|
471 |
+
```
|