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B CodeAlpaca Lora
|
7 |
+
model_type: mistral
|
8 |
+
prompt_template: 'Below is an instruction that describes a task. Write a response
|
9 |
+
that appropriately completes the request.
|
10 |
+
|
11 |
+
|
12 |
+
### Instruction:
|
13 |
+
|
14 |
+
{prompt}
|
15 |
+
|
16 |
+
|
17 |
+
### Response:
|
18 |
+
|
19 |
+
'
|
20 |
+
quantized_by: TheBloke
|
21 |
+
tags:
|
22 |
+
- code
|
23 |
+
- mistral
|
24 |
+
---
|
25 |
+
<!-- markdownlint-disable MD041 -->
|
26 |
+
|
27 |
+
<!-- header start -->
|
28 |
+
<!-- 200823 -->
|
29 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
30 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
31 |
+
</div>
|
32 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
33 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
34 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
35 |
+
</div>
|
36 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
37 |
+
<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>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
<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>
|
41 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
42 |
+
<!-- header end -->
|
43 |
+
|
44 |
+
# Mistral 7B CodeAlpaca Lora - GPTQ
|
45 |
+
- Model creator: [Kamil](https://huggingface.co/Nondzu)
|
46 |
+
- Original model: [Mistral 7B CodeAlpaca Lora](https://huggingface.co/Nondzu/Mistral-7B-codealpaca-lora)
|
47 |
+
|
48 |
+
<!-- description start -->
|
49 |
+
## Description
|
50 |
+
|
51 |
+
This repo contains GPTQ model files for [Kamil's Mistral 7B CodeAlpaca Lora](https://huggingface.co/Nondzu/Mistral-7B-codealpaca-lora).
|
52 |
+
|
53 |
+
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.
|
54 |
+
|
55 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
56 |
+
|
57 |
+
<!-- description end -->
|
58 |
+
<!-- repositories-available start -->
|
59 |
+
## Repositories available
|
60 |
+
|
61 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-AWQ)
|
62 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ)
|
63 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GGUF)
|
64 |
+
* [Kamil's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Nondzu/Mistral-7B-codealpaca-lora)
|
65 |
+
<!-- repositories-available end -->
|
66 |
+
|
67 |
+
<!-- prompt-template start -->
|
68 |
+
## Prompt template: Alpaca
|
69 |
+
|
70 |
+
```
|
71 |
+
Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
72 |
+
|
73 |
+
### Instruction:
|
74 |
+
{prompt}
|
75 |
+
|
76 |
+
### Response:
|
77 |
+
|
78 |
+
```
|
79 |
+
|
80 |
+
<!-- prompt-template end -->
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
<!-- README_GPTQ.md-compatible clients start -->
|
85 |
+
## Known compatible clients / servers
|
86 |
+
|
87 |
+
These GPTQ models are known to work in the following inference servers/webuis.
|
88 |
+
|
89 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
90 |
+
- [KobaldAI United](https://github.com/henk717/koboldai)
|
91 |
+
- [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
|
92 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
93 |
+
|
94 |
+
This may not be a complete list; if you know of others, please let me know!
|
95 |
+
<!-- README_GPTQ.md-compatible clients end -->
|
96 |
+
|
97 |
+
<!-- README_GPTQ.md-provided-files start -->
|
98 |
+
## Provided files, and GPTQ parameters
|
99 |
+
|
100 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
101 |
+
|
102 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
103 |
+
|
104 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
105 |
+
|
106 |
+
<details>
|
107 |
+
<summary>Explanation of GPTQ parameters</summary>
|
108 |
+
|
109 |
+
- Bits: The bit size of the quantised model.
|
110 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
111 |
+
- 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.
|
112 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
113 |
+
- 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).
|
114 |
+
- 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.
|
115 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
|
116 |
+
|
117 |
+
</details>
|
118 |
+
|
119 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
120 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
121 |
+
| [main](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 4.16 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
|
122 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 4.57 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
123 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 7.52 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
124 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
125 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
|
126 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 4.29 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
|
127 |
+
|
128 |
+
<!-- README_GPTQ.md-provided-files end -->
|
129 |
+
|
130 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
131 |
+
## How to download, including from branches
|
132 |
+
|
133 |
+
### In text-generation-webui
|
134 |
+
|
135 |
+
To download from the `main` branch, enter `TheBloke/Mistral-7B-codealpaca-lora-GPTQ` in the "Download model" box.
|
136 |
+
|
137 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Mistral-7B-codealpaca-lora-GPTQ:gptq-4bit-32g-actorder_True`
|
138 |
+
|
139 |
+
### From the command line
|
140 |
+
|
141 |
+
I recommend using the `huggingface-hub` Python library:
|
142 |
+
|
143 |
+
```shell
|
144 |
+
pip3 install huggingface-hub
|
145 |
+
```
|
146 |
+
|
147 |
+
To download the `main` branch to a folder called `Mistral-7B-codealpaca-lora-GPTQ`:
|
148 |
+
|
149 |
+
```shell
|
150 |
+
mkdir Mistral-7B-codealpaca-lora-GPTQ
|
151 |
+
huggingface-cli download TheBloke/Mistral-7B-codealpaca-lora-GPTQ --local-dir Mistral-7B-codealpaca-lora-GPTQ --local-dir-use-symlinks False
|
152 |
+
```
|
153 |
+
|
154 |
+
To download from a different branch, add the `--revision` parameter:
|
155 |
+
|
156 |
+
```shell
|
157 |
+
mkdir Mistral-7B-codealpaca-lora-GPTQ
|
158 |
+
huggingface-cli download TheBloke/Mistral-7B-codealpaca-lora-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Mistral-7B-codealpaca-lora-GPTQ --local-dir-use-symlinks False
|
159 |
+
```
|
160 |
+
|
161 |
+
<details>
|
162 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
163 |
+
|
164 |
+
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.
|
165 |
+
|
166 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
167 |
+
|
168 |
+
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).
|
169 |
+
|
170 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
171 |
+
|
172 |
+
```shell
|
173 |
+
pip3 install hf_transfer
|
174 |
+
```
|
175 |
+
|
176 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
177 |
+
|
178 |
+
```shell
|
179 |
+
mkdir Mistral-7B-codealpaca-lora-GPTQ
|
180 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mistral-7B-codealpaca-lora-GPTQ --local-dir Mistral-7B-codealpaca-lora-GPTQ --local-dir-use-symlinks False
|
181 |
+
```
|
182 |
+
|
183 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
184 |
+
</details>
|
185 |
+
|
186 |
+
### With `git` (**not** recommended)
|
187 |
+
|
188 |
+
To clone a specific branch with `git`, use a command like this:
|
189 |
+
|
190 |
+
```shell
|
191 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Mistral-7B-codealpaca-lora-GPTQ
|
192 |
+
```
|
193 |
+
|
194 |
+
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.)
|
195 |
+
|
196 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
197 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
198 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
199 |
+
|
200 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
201 |
+
|
202 |
+
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.
|
203 |
+
|
204 |
+
1. Click the **Model tab**.
|
205 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-7B-codealpaca-lora-GPTQ`.
|
206 |
+
|
207 |
+
- To download from a specific branch, enter for example `TheBloke/Mistral-7B-codealpaca-lora-GPTQ:gptq-4bit-32g-actorder_True`
|
208 |
+
- see Provided Files above for the list of branches for each option.
|
209 |
+
|
210 |
+
3. Click **Download**.
|
211 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
212 |
+
5. In the top left, click the refresh icon next to **Model**.
|
213 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-7B-codealpaca-lora-GPTQ`
|
214 |
+
7. The model will automatically load, and is now ready for use!
|
215 |
+
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.
|
216 |
+
|
217 |
+
- 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`.
|
218 |
+
|
219 |
+
9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
220 |
+
|
221 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
222 |
+
|
223 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
224 |
+
## Serving this model from Text Generation Inference (TGI)
|
225 |
+
|
226 |
+
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`
|
227 |
+
|
228 |
+
Example Docker parameters:
|
229 |
+
|
230 |
+
```shell
|
231 |
+
--model-id TheBloke/Mistral-7B-codealpaca-lora-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
232 |
+
```
|
233 |
+
|
234 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
235 |
+
|
236 |
+
```shell
|
237 |
+
pip3 install huggingface-hub
|
238 |
+
```
|
239 |
+
|
240 |
+
```python
|
241 |
+
from huggingface_hub import InferenceClient
|
242 |
+
|
243 |
+
endpoint_url = "https://your-endpoint-url-here"
|
244 |
+
|
245 |
+
prompt = "Tell me about AI"
|
246 |
+
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
247 |
+
|
248 |
+
### Instruction:
|
249 |
+
{prompt}
|
250 |
+
|
251 |
+
### Response:
|
252 |
+
'''
|
253 |
+
|
254 |
+
client = InferenceClient(endpoint_url)
|
255 |
+
response = client.text_generation(prompt,
|
256 |
+
max_new_tokens=128,
|
257 |
+
do_sample=True,
|
258 |
+
temperature=0.7,
|
259 |
+
top_p=0.95,
|
260 |
+
top_k=40,
|
261 |
+
repetition_penalty=1.1)
|
262 |
+
|
263 |
+
print(f"Model output: {response}")
|
264 |
+
```
|
265 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
266 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
267 |
+
## How to use this GPTQ model from Python code
|
268 |
+
|
269 |
+
### Install the necessary packages
|
270 |
+
|
271 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
272 |
+
|
273 |
+
```shell
|
274 |
+
pip3 install transformers optimum
|
275 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
276 |
+
```
|
277 |
+
|
278 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
279 |
+
|
280 |
+
```shell
|
281 |
+
pip3 uninstall -y auto-gptq
|
282 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
283 |
+
cd AutoGPTQ
|
284 |
+
git checkout v0.4.2
|
285 |
+
pip3 install .
|
286 |
+
```
|
287 |
+
|
288 |
+
### You can then use the following code
|
289 |
+
|
290 |
+
```python
|
291 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
292 |
+
|
293 |
+
model_name_or_path = "TheBloke/Mistral-7B-codealpaca-lora-GPTQ"
|
294 |
+
# To use a different branch, change revision
|
295 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
296 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
297 |
+
device_map="auto",
|
298 |
+
trust_remote_code=False,
|
299 |
+
revision="main")
|
300 |
+
|
301 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
302 |
+
|
303 |
+
prompt = "Tell me about AI"
|
304 |
+
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
305 |
+
|
306 |
+
### Instruction:
|
307 |
+
{prompt}
|
308 |
+
|
309 |
+
### Response:
|
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: Kamil's Mistral 7B CodeAlpaca Lora
|
382 |
+
|
383 |
+
|
384 |
+
# Mistral-7B-codealpaca
|
385 |
+
|
386 |
+
I am thrilled to introduce my Mistral-7B-codealpaca model. This variant is optimized and demonstrates potential in assisting developers as a coding companion. I welcome contributions from testers and enthusiasts to help evaluate its performance.
|
387 |
+
|
388 |
+
## Training Details
|
389 |
+
|
390 |
+
I trained the model using 3xRTX 3090 for 118 hours.
|
391 |
+
[![Built with Axolotl](https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png)](https://github.com/OpenAccess-AI-Collective/axolotl)
|
392 |
+
|
393 |
+
## Quantised Model Links:
|
394 |
+
|
395 |
+
1.
|
396 |
+
2.
|
397 |
+
3.
|
398 |
+
|
399 |
+
## Dataset:
|
400 |
+
|
401 |
+
- Dataset Name: theblackcat102/evol-codealpaca-v1
|
402 |
+
- Dataset Link: [theblackcat102/evol-codealpaca-v1](https://huggingface.co/datasets/theblackcat102/evol-codealpaca-v1)
|
403 |
+
|
404 |
+
## Prompt template: Alpaca
|
405 |
+
|
406 |
+
```
|
407 |
+
Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
408 |
+
|
409 |
+
### Instruction:
|
410 |
+
{prompt}
|
411 |
+
|
412 |
+
### Response:
|
413 |
+
|
414 |
+
```
|
415 |
+
|
416 |
+
|
417 |
+
## Performance (evalplus)
|
418 |
+
Human eval plus: https://github.com/evalplus/evalplus
|
419 |
+
|
420 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/63729f35acef705233c87909/azE6LU0qQ9E9u60t5VrMk.png)
|
421 |
+
|
422 |
+
Well, the results are better than I expected:
|
423 |
+
- Base: `{'pass@1': 0.47560975609756095}`
|
424 |
+
- Base + Extra: `{'pass@1': 0.4329268292682927}`
|
425 |
+
|
426 |
+
For reference, I've provided the performance of the original Mistral model alongside my Mistral-7B-code-16k-qlora model.
|
427 |
+
|
428 |
+
** [Nondzu/Mistral-7B-code-16k-qlora](https://huggingface.co/Nondzu/Mistral-7B-code-16k-qlora)**:
|
429 |
+
|
430 |
+
- Base: `{'pass@1': 0.3353658536585366}`
|
431 |
+
- Base + Extra: `{'pass@1': 0.2804878048780488}`
|
432 |
+
|
433 |
+
** [mistralai/Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)**:
|
434 |
+
|
435 |
+
- Base: `{'pass@1': 0.2926829268292683}`
|
436 |
+
- Base + Extra: `{'pass@1': 0.24390243902439024}`
|
437 |
+
|
438 |
+
## Model Configuration:
|
439 |
+
|
440 |
+
Here are the configurations for my Mistral-7B-codealpaca-lora:
|
441 |
+
|
442 |
+
```yaml
|
443 |
+
base_model: mistralai/Mistral-7B-Instruct-v0.1
|
444 |
+
base_model_config: mistralai/Mistral-7B-Instruct-v0.1
|
445 |
+
model_type: MistralForCausalLM
|
446 |
+
tokenizer_type: LlamaTokenizer
|
447 |
+
is_mistral_derived_model: true
|
448 |
+
load_in_8bit: true
|
449 |
+
load_in_4bit: false
|
450 |
+
strict: false
|
451 |
+
datasets:
|
452 |
+
- path: theblackcat102/evol-codealpaca-v1
|
453 |
+
type: oasst
|
454 |
+
dataset_prepared_path:
|
455 |
+
val_set_size: 0.01
|
456 |
+
output_dir: ./nondzu/Mistral-7B-codealpaca-test14
|
457 |
+
adapter: lora
|
458 |
+
sequence_len: 4096
|
459 |
+
sample_packing: true
|
460 |
+
pad_to_sequence_len: true
|
461 |
+
lora_r: 32
|
462 |
+
lora_alpha: 16
|
463 |
+
lora_dropout: 0.05
|
464 |
+
lora_target_modules:
|
465 |
+
lora_target_linear: true
|
466 |
+
```
|
467 |
+
|
468 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/63729f35acef705233c87909/5nPgL3ajROKf7dttf4BO0.png)
|
469 |
+
|
470 |
+
## Additional Projects:
|
471 |
+
|
472 |
+
For other related projects, you can check out:
|
473 |
+
|
474 |
+
- [LlamaTor on GitHub](https://github.com/Nondzu/LlamaTor)
|