Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,423 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: lgaalves/tinyllama-1.1b-chat-v0.3_platypus
|
3 |
+
datasets:
|
4 |
+
- garage-bAInd/Open-Platypus
|
5 |
+
inference: false
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
license: other
|
9 |
+
model_creator: Luiz G. A. Alves
|
10 |
+
model_name: Tinyllama 1.1B Chat v0.3 Platypus
|
11 |
+
model_type: llama
|
12 |
+
pipeline_tag: text-generation
|
13 |
+
prompt_template: 'Below is an instruction that describes a task. Write a response
|
14 |
+
that appropriately completes the request.
|
15 |
+
|
16 |
+
|
17 |
+
### Instruction:
|
18 |
+
|
19 |
+
{prompt}
|
20 |
+
|
21 |
+
|
22 |
+
### Response:
|
23 |
+
|
24 |
+
'
|
25 |
+
quantized_by: TheBloke
|
26 |
+
---
|
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 |
+
# Tinyllama 1.1B Chat v0.3 Platypus - GPTQ
|
46 |
+
- Model creator: [Luiz G. A. Alves](https://huggingface.co/lgaalves)
|
47 |
+
- Original model: [Tinyllama 1.1B Chat v0.3 Platypus](https://huggingface.co/lgaalves/tinyllama-1.1b-chat-v0.3_platypus)
|
48 |
+
|
49 |
+
<!-- description start -->
|
50 |
+
## Description
|
51 |
+
|
52 |
+
This repo contains GPTQ model files for [Luiz G. A. Alves's Tinyllama 1.1B Chat v0.3 Platypus](https://huggingface.co/lgaalves/tinyllama-1.1b-chat-v0.3_platypus).
|
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 |
+
<!-- description end -->
|
57 |
+
<!-- repositories-available start -->
|
58 |
+
## Repositories available
|
59 |
+
|
60 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-AWQ)
|
61 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ)
|
62 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GGUF)
|
63 |
+
* [Luiz G. A. Alves's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/lgaalves/tinyllama-1.1b-chat-v0.3_platypus)
|
64 |
+
<!-- repositories-available end -->
|
65 |
+
|
66 |
+
<!-- prompt-template start -->
|
67 |
+
## Prompt template: Alpaca
|
68 |
+
|
69 |
+
```
|
70 |
+
Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
71 |
+
|
72 |
+
### Instruction:
|
73 |
+
{prompt}
|
74 |
+
|
75 |
+
### Response:
|
76 |
+
|
77 |
+
```
|
78 |
+
|
79 |
+
<!-- prompt-template end -->
|
80 |
+
|
81 |
+
|
82 |
+
<!-- README_GPTQ.md-provided-files start -->
|
83 |
+
## Provided files, and GPTQ parameters
|
84 |
+
|
85 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
86 |
+
|
87 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
88 |
+
|
89 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
90 |
+
|
91 |
+
<details>
|
92 |
+
<summary>Explanation of GPTQ parameters</summary>
|
93 |
+
|
94 |
+
- Bits: The bit size of the quantised model.
|
95 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
96 |
+
- 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.
|
97 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
98 |
+
- 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).
|
99 |
+
- 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.
|
100 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
|
101 |
+
|
102 |
+
</details>
|
103 |
+
|
104 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
105 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
106 |
+
| [main](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 0.77 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
|
107 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 0.82 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
108 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 1.23 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
109 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 1.26 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
110 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 1.32 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
|
111 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 0.79 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
|
112 |
+
|
113 |
+
<!-- README_GPTQ.md-provided-files end -->
|
114 |
+
|
115 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
116 |
+
## How to download, including from branches
|
117 |
+
|
118 |
+
### In text-generation-webui
|
119 |
+
|
120 |
+
To download from the `main` branch, enter `TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ` in the "Download model" box.
|
121 |
+
|
122 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ:gptq-4bit-32g-actorder_True`
|
123 |
+
|
124 |
+
### From the command line
|
125 |
+
|
126 |
+
I recommend using the `huggingface-hub` Python library:
|
127 |
+
|
128 |
+
```shell
|
129 |
+
pip3 install huggingface-hub
|
130 |
+
```
|
131 |
+
|
132 |
+
To download the `main` branch to a folder called `tinyllama-1.1b-chat-v0.3_platypus-GPTQ`:
|
133 |
+
|
134 |
+
```shell
|
135 |
+
mkdir tinyllama-1.1b-chat-v0.3_platypus-GPTQ
|
136 |
+
huggingface-cli download TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ --local-dir tinyllama-1.1b-chat-v0.3_platypus-GPTQ --local-dir-use-symlinks False
|
137 |
+
```
|
138 |
+
|
139 |
+
To download from a different branch, add the `--revision` parameter:
|
140 |
+
|
141 |
+
```shell
|
142 |
+
mkdir tinyllama-1.1b-chat-v0.3_platypus-GPTQ
|
143 |
+
huggingface-cli download TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir tinyllama-1.1b-chat-v0.3_platypus-GPTQ --local-dir-use-symlinks False
|
144 |
+
```
|
145 |
+
|
146 |
+
<details>
|
147 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
148 |
+
|
149 |
+
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.
|
150 |
+
|
151 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
152 |
+
|
153 |
+
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).
|
154 |
+
|
155 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
156 |
+
|
157 |
+
```shell
|
158 |
+
pip3 install hf_transfer
|
159 |
+
```
|
160 |
+
|
161 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
162 |
+
|
163 |
+
```shell
|
164 |
+
mkdir tinyllama-1.1b-chat-v0.3_platypus-GPTQ
|
165 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ --local-dir tinyllama-1.1b-chat-v0.3_platypus-GPTQ --local-dir-use-symlinks False
|
166 |
+
```
|
167 |
+
|
168 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
169 |
+
</details>
|
170 |
+
|
171 |
+
### With `git` (**not** recommended)
|
172 |
+
|
173 |
+
To clone a specific branch with `git`, use a command like this:
|
174 |
+
|
175 |
+
```shell
|
176 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ
|
177 |
+
```
|
178 |
+
|
179 |
+
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.)
|
180 |
+
|
181 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
182 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
183 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
184 |
+
|
185 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
186 |
+
|
187 |
+
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.
|
188 |
+
|
189 |
+
1. Click the **Model tab**.
|
190 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ`.
|
191 |
+
- To download from a specific branch, enter for example `TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ:gptq-4bit-32g-actorder_True`
|
192 |
+
- see Provided Files above for the list of branches for each option.
|
193 |
+
3. Click **Download**.
|
194 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
195 |
+
5. In the top left, click the refresh icon next to **Model**.
|
196 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `tinyllama-1.1b-chat-v0.3_platypus-GPTQ`
|
197 |
+
7. The model will automatically load, and is now ready for use!
|
198 |
+
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.
|
199 |
+
* 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`.
|
200 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
201 |
+
|
202 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
203 |
+
|
204 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
205 |
+
## Serving this model from Text Generation Inference (TGI)
|
206 |
+
|
207 |
+
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`
|
208 |
+
|
209 |
+
Example Docker parameters:
|
210 |
+
|
211 |
+
```shell
|
212 |
+
--model-id TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
213 |
+
```
|
214 |
+
|
215 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
216 |
+
|
217 |
+
```shell
|
218 |
+
pip3 install huggingface-hub
|
219 |
+
```
|
220 |
+
|
221 |
+
```python
|
222 |
+
from huggingface_hub import InferenceClient
|
223 |
+
|
224 |
+
endpoint_url = "https://your-endpoint-url-here"
|
225 |
+
|
226 |
+
prompt = "Tell me about AI"
|
227 |
+
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
228 |
+
|
229 |
+
### Instruction:
|
230 |
+
{prompt}
|
231 |
+
|
232 |
+
### Response:
|
233 |
+
'''
|
234 |
+
|
235 |
+
client = InferenceClient(endpoint_url)
|
236 |
+
response = client.text_generation(prompt,
|
237 |
+
max_new_tokens=128,
|
238 |
+
do_sample=True,
|
239 |
+
temperature=0.7,
|
240 |
+
top_p=0.95,
|
241 |
+
top_k=40,
|
242 |
+
repetition_penalty=1.1)
|
243 |
+
|
244 |
+
print(f"Model output: {response}")
|
245 |
+
```
|
246 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
247 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
248 |
+
## How to use this GPTQ model from Python code
|
249 |
+
|
250 |
+
### Install the necessary packages
|
251 |
+
|
252 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
253 |
+
|
254 |
+
```shell
|
255 |
+
pip3 install transformers optimum
|
256 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
257 |
+
```
|
258 |
+
|
259 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
260 |
+
|
261 |
+
```shell
|
262 |
+
pip3 uninstall -y auto-gptq
|
263 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
264 |
+
cd AutoGPTQ
|
265 |
+
git checkout v0.4.2
|
266 |
+
pip3 install .
|
267 |
+
```
|
268 |
+
|
269 |
+
### You can then use the following code
|
270 |
+
|
271 |
+
```python
|
272 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
273 |
+
|
274 |
+
model_name_or_path = "TheBloke/tinyllama-1.1b-chat-v0.3_platypus-GPTQ"
|
275 |
+
# To use a different branch, change revision
|
276 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
277 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
278 |
+
device_map="auto",
|
279 |
+
trust_remote_code=False,
|
280 |
+
revision="main")
|
281 |
+
|
282 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
283 |
+
|
284 |
+
prompt = "Tell me about AI"
|
285 |
+
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
286 |
+
|
287 |
+
### Instruction:
|
288 |
+
{prompt}
|
289 |
+
|
290 |
+
### Response:
|
291 |
+
'''
|
292 |
+
|
293 |
+
print("\n\n*** Generate:")
|
294 |
+
|
295 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
296 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
297 |
+
print(tokenizer.decode(output[0]))
|
298 |
+
|
299 |
+
# Inference can also be done using transformers' pipeline
|
300 |
+
|
301 |
+
print("*** Pipeline:")
|
302 |
+
pipe = pipeline(
|
303 |
+
"text-generation",
|
304 |
+
model=model,
|
305 |
+
tokenizer=tokenizer,
|
306 |
+
max_new_tokens=512,
|
307 |
+
do_sample=True,
|
308 |
+
temperature=0.7,
|
309 |
+
top_p=0.95,
|
310 |
+
top_k=40,
|
311 |
+
repetition_penalty=1.1
|
312 |
+
)
|
313 |
+
|
314 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
315 |
+
```
|
316 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
317 |
+
|
318 |
+
<!-- README_GPTQ.md-compatibility start -->
|
319 |
+
## Compatibility
|
320 |
+
|
321 |
+
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).
|
322 |
+
|
323 |
+
[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.
|
324 |
+
|
325 |
+
[Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
|
326 |
+
<!-- README_GPTQ.md-compatibility end -->
|
327 |
+
|
328 |
+
<!-- footer start -->
|
329 |
+
<!-- 200823 -->
|
330 |
+
## Discord
|
331 |
+
|
332 |
+
For further support, and discussions on these models and AI in general, join us at:
|
333 |
+
|
334 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
335 |
+
|
336 |
+
## Thanks, and how to contribute
|
337 |
+
|
338 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
339 |
+
|
340 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
341 |
+
|
342 |
+
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.
|
343 |
+
|
344 |
+
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.
|
345 |
+
|
346 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
347 |
+
|
348 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
349 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
350 |
+
|
351 |
+
**Special thanks to**: Aemon Algiz.
|
352 |
+
|
353 |
+
**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
|
354 |
+
|
355 |
+
|
356 |
+
Thank you to all my generous patrons and donaters!
|
357 |
+
|
358 |
+
And thank you again to a16z for their generous grant.
|
359 |
+
|
360 |
+
<!-- footer end -->
|
361 |
+
|
362 |
+
# Original model card: Luiz G. A. Alves's Tinyllama 1.1B Chat v0.3 Platypus
|
363 |
+
|
364 |
+
|
365 |
+
|
366 |
+
|
367 |
+
# tinyllama-1.1b-chat-v0.3_platypus
|
368 |
+
|
369 |
+
**tinyllama-1.1b-chat-v0.3_platypus** is an instruction fine-tuned model based on the tinyllama transformer architecture.
|
370 |
+
|
371 |
+
|
372 |
+
### Benchmark Metrics
|
373 |
+
|
374 |
+
| Metric |lgaalves/tinyllama-1.1b-chat-v0.3_platypus | tinyllama-1.1b-chat-v0.3 |
|
375 |
+
|-----------------------|-------|-------|
|
376 |
+
| Avg. | 37.67 | **38.74** |
|
377 |
+
| ARC (25-shot) | 30.29 | **35.07** |
|
378 |
+
| HellaSwag (10-shot) | 55.12 | **57.7** |
|
379 |
+
| MMLU (5-shot) | **26.13** | 25.53 |
|
380 |
+
| TruthfulQA (0-shot) | **39.15** | 36.67 |
|
381 |
+
|
382 |
+
|
383 |
+
We use state-of-the-art [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) to run the benchmark tests above, using the same version as the HuggingFace LLM Leaderboard. Please see below for detailed instructions on reproducing benchmark results.
|
384 |
+
|
385 |
+
### Model Details
|
386 |
+
|
387 |
+
* **Trained by**: Luiz G A Alves
|
388 |
+
* **Model type:** **tinyllama-1.1b-chat-v0.3_platypus** is an auto-regressive language model based on the tinyllama transformer architecture.
|
389 |
+
* **Language(s)**: English
|
390 |
+
|
391 |
+
### How to use:
|
392 |
+
|
393 |
+
```python
|
394 |
+
# Use a pipeline as a high-level helper
|
395 |
+
>>> from transformers import pipeline
|
396 |
+
>>> pipe = pipeline("text-generation", model="lgaalves/tinyllama-1.1b-chat-v0.3_platypus")
|
397 |
+
>>> question = "What is a large language model?"
|
398 |
+
>>> answer = pipe(question)
|
399 |
+
>>> print(answer[0]['generated_text'])
|
400 |
+
```
|
401 |
+
|
402 |
+
or, you can load the model direclty using:
|
403 |
+
|
404 |
+
```python
|
405 |
+
# Load model directly
|
406 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
407 |
+
|
408 |
+
tokenizer = AutoTokenizer.from_pretrained("lgaalves/tinyllama-1.1b-chat-v0.3_platypus")
|
409 |
+
model = AutoModelForCausalLM.from_pretrained("lgaalves/tinyllama-1.1b-chat-v0.3_platypus")
|
410 |
+
```
|
411 |
+
|
412 |
+
### Training Dataset
|
413 |
+
|
414 |
+
`lgaalves/tinyllama-1.1b-chat-v0.3_platypus` trained using STEM and logic based dataset [garage-bAInd/Open-Platypus](https://huggingface.co/datasets/garage-bAInd/Open-Platypus).
|
415 |
+
|
416 |
+
### Training Procedure
|
417 |
+
|
418 |
+
`lgaalves/tinyllama-1.1b-chat-v0.3_platypus` was instruction fine-tuned using LoRA on 1 V100 GPU on Google Colab. It took about 43 minutes to train it.
|
419 |
+
|
420 |
+
|
421 |
+
# Intended uses, limitations & biases
|
422 |
+
|
423 |
+
You can use the raw model for text generation or fine-tune it to a downstream task. The model was not extensively tested and may produce false information. It contains a lot of unfiltered content from the internet, which is far from neutral.
|