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12 |
+
model_creator: NousResearch
|
13 |
+
model_name: Nous Capybara 7B
|
14 |
+
model_type: llama
|
15 |
+
prompt_template: 'USER: {prompt}
|
16 |
+
|
17 |
+
ASSISTANT:
|
18 |
+
|
19 |
+
'
|
20 |
+
quantized_by: TheBloke
|
21 |
+
tags:
|
22 |
+
- llama-2
|
23 |
+
- sft
|
24 |
+
---
|
25 |
+
|
26 |
+
<!-- header start -->
|
27 |
+
<!-- 200823 -->
|
28 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
29 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
30 |
+
</div>
|
31 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
32 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
33 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
34 |
+
</div>
|
35 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
36 |
+
<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>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
<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>
|
40 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
41 |
+
<!-- header end -->
|
42 |
+
|
43 |
+
# Nous Capybara 7B - GPTQ
|
44 |
+
- Model creator: [NousResearch](https://huggingface.co/NousResearch)
|
45 |
+
- Original model: [Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B)
|
46 |
+
|
47 |
+
<!-- description start -->
|
48 |
+
## Description
|
49 |
+
|
50 |
+
This repo contains GPTQ model files for [NousResearch's Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B).
|
51 |
+
|
52 |
+
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.
|
53 |
+
|
54 |
+
<!-- description end -->
|
55 |
+
<!-- repositories-available start -->
|
56 |
+
## Repositories available
|
57 |
+
|
58 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Nous-Capybara-7B-AWQ)
|
59 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ)
|
60 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Nous-Capybara-7B-GGUF)
|
61 |
+
* [NousResearch's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/NousResearch/Nous-Capybara-7B)
|
62 |
+
<!-- repositories-available end -->
|
63 |
+
|
64 |
+
<!-- prompt-template start -->
|
65 |
+
## Prompt template: User-Assistant
|
66 |
+
|
67 |
+
```
|
68 |
+
USER: {prompt}
|
69 |
+
ASSISTANT:
|
70 |
+
|
71 |
+
```
|
72 |
+
|
73 |
+
<!-- prompt-template end -->
|
74 |
+
<!-- licensing start -->
|
75 |
+
## Licensing
|
76 |
+
|
77 |
+
The creator of the source model has listed its license as `['mit']`, and this quantization has therefore used that same license.
|
78 |
+
|
79 |
+
As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
|
80 |
+
|
81 |
+
In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [NousResearch's Nous Capybara 7B](https://huggingface.co/NousResearch/Nous-Capybara-7B).
|
82 |
+
<!-- licensing end -->
|
83 |
+
<!-- README_GPTQ.md-provided-files start -->
|
84 |
+
## Provided files, and GPTQ parameters
|
85 |
+
|
86 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
87 |
+
|
88 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
89 |
+
|
90 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
91 |
+
|
92 |
+
<details>
|
93 |
+
<summary>Explanation of GPTQ parameters</summary>
|
94 |
+
|
95 |
+
- Bits: The bit size of the quantised model.
|
96 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
97 |
+
- 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.
|
98 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
99 |
+
- 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).
|
100 |
+
- 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.
|
101 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
|
102 |
+
|
103 |
+
</details>
|
104 |
+
|
105 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
106 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
107 |
+
| [main](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 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. |
|
108 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
109 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
110 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
111 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.62 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
|
112 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
|
113 |
+
|
114 |
+
<!-- README_GPTQ.md-provided-files end -->
|
115 |
+
|
116 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
117 |
+
## How to download, including from branches
|
118 |
+
|
119 |
+
### In text-generation-webui
|
120 |
+
|
121 |
+
To download from the `main` branch, enter `TheBloke/Nous-Capybara-7B-GPTQ` in the "Download model" box.
|
122 |
+
|
123 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Nous-Capybara-7B-GPTQ:gptq-4bit-32g-actorder_True`
|
124 |
+
|
125 |
+
### From the command line
|
126 |
+
|
127 |
+
I recommend using the `huggingface-hub` Python library:
|
128 |
+
|
129 |
+
```shell
|
130 |
+
pip3 install huggingface-hub
|
131 |
+
```
|
132 |
+
|
133 |
+
To download the `main` branch to a folder called `Nous-Capybara-7B-GPTQ`:
|
134 |
+
|
135 |
+
```shell
|
136 |
+
mkdir Nous-Capybara-7B-GPTQ
|
137 |
+
huggingface-cli download TheBloke/Nous-Capybara-7B-GPTQ --local-dir Nous-Capybara-7B-GPTQ --local-dir-use-symlinks False
|
138 |
+
```
|
139 |
+
|
140 |
+
To download from a different branch, add the `--revision` parameter:
|
141 |
+
|
142 |
+
```shell
|
143 |
+
mkdir Nous-Capybara-7B-GPTQ
|
144 |
+
huggingface-cli download TheBloke/Nous-Capybara-7B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Nous-Capybara-7B-GPTQ --local-dir-use-symlinks False
|
145 |
+
```
|
146 |
+
|
147 |
+
<details>
|
148 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
149 |
+
|
150 |
+
If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface 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.
|
151 |
+
|
152 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
153 |
+
|
154 |
+
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).
|
155 |
+
|
156 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
157 |
+
|
158 |
+
```shell
|
159 |
+
pip3 install hf_transfer
|
160 |
+
```
|
161 |
+
|
162 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
163 |
+
|
164 |
+
```shell
|
165 |
+
mkdir Nous-Capybara-7B-GPTQ
|
166 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Nous-Capybara-7B-GPTQ --local-dir Nous-Capybara-7B-GPTQ --local-dir-use-symlinks False
|
167 |
+
```
|
168 |
+
|
169 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
170 |
+
</details>
|
171 |
+
|
172 |
+
### With `git` (**not** recommended)
|
173 |
+
|
174 |
+
To clone a specific branch with `git`, use a command like this:
|
175 |
+
|
176 |
+
```shell
|
177 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Nous-Capybara-7B-GPTQ
|
178 |
+
```
|
179 |
+
|
180 |
+
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.)
|
181 |
+
|
182 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
183 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
184 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
185 |
+
|
186 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
187 |
+
|
188 |
+
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.
|
189 |
+
|
190 |
+
1. Click the **Model tab**.
|
191 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/Nous-Capybara-7B-GPTQ`.
|
192 |
+
- To download from a specific branch, enter for example `TheBloke/Nous-Capybara-7B-GPTQ:gptq-4bit-32g-actorder_True`
|
193 |
+
- see Provided Files above for the list of branches for each option.
|
194 |
+
3. Click **Download**.
|
195 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
196 |
+
5. In the top left, click the refresh icon next to **Model**.
|
197 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `Nous-Capybara-7B-GPTQ`
|
198 |
+
7. The model will automatically load, and is now ready for use!
|
199 |
+
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.
|
200 |
+
* 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`.
|
201 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
202 |
+
|
203 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
204 |
+
|
205 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
206 |
+
## Serving this model from Text Generation Inference (TGI)
|
207 |
+
|
208 |
+
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`
|
209 |
+
|
210 |
+
Example Docker parameters:
|
211 |
+
|
212 |
+
```shell
|
213 |
+
--model-id TheBloke/Nous-Capybara-7B-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
214 |
+
```
|
215 |
+
|
216 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
217 |
+
|
218 |
+
```shell
|
219 |
+
pip3 install huggingface-hub
|
220 |
+
```
|
221 |
+
|
222 |
+
```python
|
223 |
+
from huggingface_hub import InferenceClient
|
224 |
+
|
225 |
+
endpoint_url = "https://your-endpoint-url-here"
|
226 |
+
|
227 |
+
prompt = "Tell me about AI"
|
228 |
+
prompt_template=f'''USER: {prompt}
|
229 |
+
ASSISTANT:
|
230 |
+
'''
|
231 |
+
|
232 |
+
client = InferenceClient(endpoint_url)
|
233 |
+
response = client.text_generation(prompt,
|
234 |
+
max_new_tokens=128,
|
235 |
+
do_sample=True,
|
236 |
+
temperature=0.7,
|
237 |
+
top_p=0.95,
|
238 |
+
top_k=40,
|
239 |
+
repetition_penalty=1.1)
|
240 |
+
|
241 |
+
print(f"Model output: {response}")
|
242 |
+
```
|
243 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
244 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
245 |
+
## How to use this GPTQ model from Python code
|
246 |
+
|
247 |
+
### Install the necessary packages
|
248 |
+
|
249 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
250 |
+
|
251 |
+
```shell
|
252 |
+
pip3 install transformers optimum
|
253 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
254 |
+
```
|
255 |
+
|
256 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
257 |
+
|
258 |
+
```shell
|
259 |
+
pip3 uninstall -y auto-gptq
|
260 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
261 |
+
cd AutoGPTQ
|
262 |
+
git checkout v0.4.2
|
263 |
+
pip3 install .
|
264 |
+
```
|
265 |
+
|
266 |
+
### You can then use the following code
|
267 |
+
|
268 |
+
```python
|
269 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
270 |
+
|
271 |
+
model_name_or_path = "TheBloke/Nous-Capybara-7B-GPTQ"
|
272 |
+
# To use a different branch, change revision
|
273 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
274 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
275 |
+
device_map="auto",
|
276 |
+
trust_remote_code=False,
|
277 |
+
revision="main")
|
278 |
+
|
279 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
280 |
+
|
281 |
+
prompt = "Tell me about AI"
|
282 |
+
prompt_template=f'''USER: {prompt}
|
283 |
+
ASSISTANT:
|
284 |
+
'''
|
285 |
+
|
286 |
+
print("\n\n*** Generate:")
|
287 |
+
|
288 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
289 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
290 |
+
print(tokenizer.decode(output[0]))
|
291 |
+
|
292 |
+
# Inference can also be done using transformers' pipeline
|
293 |
+
|
294 |
+
print("*** Pipeline:")
|
295 |
+
pipe = pipeline(
|
296 |
+
"text-generation",
|
297 |
+
model=model,
|
298 |
+
tokenizer=tokenizer,
|
299 |
+
max_new_tokens=512,
|
300 |
+
do_sample=True,
|
301 |
+
temperature=0.7,
|
302 |
+
top_p=0.95,
|
303 |
+
top_k=40,
|
304 |
+
repetition_penalty=1.1
|
305 |
+
)
|
306 |
+
|
307 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
308 |
+
```
|
309 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
310 |
+
|
311 |
+
<!-- README_GPTQ.md-compatibility start -->
|
312 |
+
## Compatibility
|
313 |
+
|
314 |
+
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).
|
315 |
+
|
316 |
+
[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.
|
317 |
+
|
318 |
+
[Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
|
319 |
+
<!-- README_GPTQ.md-compatibility end -->
|
320 |
+
|
321 |
+
<!-- footer start -->
|
322 |
+
<!-- 200823 -->
|
323 |
+
## Discord
|
324 |
+
|
325 |
+
For further support, and discussions on these models and AI in general, join us at:
|
326 |
+
|
327 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
328 |
+
|
329 |
+
## Thanks, and how to contribute
|
330 |
+
|
331 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
332 |
+
|
333 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
334 |
+
|
335 |
+
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.
|
336 |
+
|
337 |
+
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.
|
338 |
+
|
339 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
340 |
+
|
341 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
342 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
343 |
+
|
344 |
+
**Special thanks to**: Aemon Algiz.
|
345 |
+
|
346 |
+
**Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
|
347 |
+
|
348 |
+
|
349 |
+
Thank you to all my generous patrons and donaters!
|
350 |
+
|
351 |
+
And thank you again to a16z for their generous grant.
|
352 |
+
|
353 |
+
<!-- footer end -->
|
354 |
+
|
355 |
+
# Original model card: NousResearch's Nous Capybara 7B
|
356 |
+
|
357 |
+
|
358 |
+
## **Nous-Capybara-7B**
|
359 |
+
|
360 |
+
A model created with a novel synthesis method in mind, Amplify-instruct, with a goal of having a synergistic combination of different techniques used for SOTA models such as Evol-Instruct, Orca, Vicuna, Lamini, FLASK and others, all into one lean holistically formed dataset and model. The seed instructions used for the start of synthesized conversations are largely based on highly acclaimed datasets like Airoboros, Know logic, EverythingLM, GPTeacher and even entirely new seed instructions derived from posts on the website LessWrong, as well as being supplemented with certain multi-turn datasets like Dove(A successor to Puffin).
|
361 |
+
|
362 |
+
Entirely contained under 20K training examples, mostly comprised of newly synthesized tokens never used for model training until now!
|
363 |
+
|
364 |
+
## Process of creation and special thank yous!
|
365 |
+
|
366 |
+
This model was fine-tuned by Nous Research, with LDJ leading the training and dataset curation, along with significant dataset formation contributions by J-Supha, Also thank you to Emozilla for also assisting to expedite the training experimentation process.
|
367 |
+
|
368 |
+
Special thank you to **A16Z** for sponsoring our training, as well as **Yield Protocol** for their support in resources during R&D of aspects outside of training, such as dataset development/synthesis.
|
369 |
+
|
370 |
+
## Thank you to dataset creators!
|
371 |
+
|
372 |
+
While most of the tokens within Capybara are newly synthsized and part of datasets like Puffin/Dove, we would like to credit the single-turn datasets we leveraged as seeds that are used to initiate the beggining of many of the multi-turn conversations:
|
373 |
+
|
374 |
+
![Capybara](https://i.imgur.com/yB58OoD.jpeg)
|
375 |
+
|
376 |
+
## Model Training
|
377 |
+
|
378 |
+
Nous-Capybara 7B is a new model trained for multiple epochs on a dataset of less than 20,000 carefully curated GPT-4 examples, most of which are long context conversations between a real human and GPT-4 comprised of entirely newly synthesized tokens that previously didn't exist on HuggingFace.
|
379 |
+
|
380 |
+
Additional data came from manually curated CamelAI data, with the help of volunteers ranging from former Physicists, Mathematicians, Biologists and more!
|
381 |
+
|
382 |
+
Specific credits to the people involved in validating this data will be posted soon :)
|
383 |
+
|
384 |
+
## Prompt Format
|
385 |
+
|
386 |
+
The reccomended model usage is:
|
387 |
+
|
388 |
+
```
|
389 |
+
USER:
|
390 |
+
|
391 |
+
ASSISTANT:
|
392 |
+
```
|
393 |
+
|
394 |
+
## Notable Features:
|
395 |
+
|
396 |
+
- The first Nous model trained on over 10,000 multi-turn conversations.
|
397 |
+
|
398 |
+
- Over 1,000 tokens average per conversation example during training!
|
399 |
+
|
400 |
+
- Able to effectively do complex summary of advanced studies on topics.
|
401 |
+
|
402 |
+
- Ability to recall information upto late 2022 without internet (ChatGPT cut off date is in 2021)
|
403 |
+
|
404 |
+
- Context length of 4096 tokens, and fine-tuned on a significant amount of multi-turn conversations reaching that full token limit.
|
405 |
+
|
406 |
+
- Includes a portion of conversational data synthesized from less wrong posts, speaking in-depth about the nature of rationality, reasoning and self-improvement.
|
407 |
+
|
408 |
+
## Example Outputs!:
|
409 |
+
|
410 |
+
![Capybara](https://img001.prntscr.com/file/img001/T9yYxR1xQSaK_UGdy3t2Cw.png)
|
411 |
+
|
412 |
+
![Capybara](https://img001.prntscr.com/file/img001/DQXqmKbsQQOIcgny1eoGNA.png)
|
413 |
+
|
414 |
+
![Capybara](https://img001.prntscr.com/file/img001/85X3L9ZxTsOKo3fUQ7GRVA.png)
|
415 |
+
|
416 |
+
## Benchmarks! (Important to note that all mentioned benchmarks are single-turn and don't test multi-turn capabilities, Capybara should excel even further at multi-turn conversational tasks.)
|
417 |
+
|
418 |
+
![Capybara](https://i.imgur.com/n8lkmyK.png)
|
419 |
+
|
420 |
+
## Limitations
|
421 |
+
|
422 |
+
We noticed that the current version of Capybara still has some issues in some situations with censoring itself and not acting as expected in certain edge cases, we plan to have this largely resolved in the near future with Capybara 1.1
|
423 |
+
|
424 |
+
## Future Changes
|
425 |
+
|
426 |
+
This is a relatively early build amongst the grand plans for the future of Capybara!
|
427 |
+
|
428 |
+
Current limitations: We are still running experimentation and tests for the training pipeline and dataset cleaning process to be more refined, we plan to release a Capybara 1.1 with these improvements.
|
429 |
+
|
430 |
+
## Future model sizes
|
431 |
+
|
432 |
+
We plan on releasing a 3B, 13B and 70B version, as well as a potential 1B version based on phi-1.5 or similar architectures.
|
433 |
+
|
434 |
+
## How you can help!
|
435 |
+
|
436 |
+
In the near future we plan on leveraging the help of domain specific expert volunteers to eliminate any mathematically/verifiably incorrect answers from our training curations.
|
437 |
+
|
438 |
+
If you have at-least a bachelors in mathematics, physics, biology or chemistry and would like to volunteer even just 30 minutes of your expertise time, please contact LDJ on discord!
|
439 |
+
|
440 |
+
## Dataset contamination.
|
441 |
+
|
442 |
+
We checked for 100%, 99%, 98% and 97% similarity matches between our data and many popular benchmarks, we found no exact matches!
|
443 |
+
|
444 |
+
The following are benchmarks we checked for contamination for:
|
445 |
+
|
446 |
+
- HumanEval
|
447 |
+
|
448 |
+
- AGIEval
|
449 |
+
|
450 |
+
- TruthfulQA
|
451 |
+
|
452 |
+
- MMLU
|
453 |
+
|
454 |
+
- GPT4All
|