Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: llmware/dragon-yi-6b-v0
|
3 |
+
inference: false
|
4 |
+
license: other
|
5 |
+
license_link: https://huggingface.co/01-ai/Yi-6B/blob/main/LICENSE
|
6 |
+
license_name: yi-license
|
7 |
+
model_creator: llmware
|
8 |
+
model_name: Dragon Yi 6B v0
|
9 |
+
model_type: yi
|
10 |
+
prompt_template: '<human>: {prompt}
|
11 |
+
|
12 |
+
<bot>:
|
13 |
+
|
14 |
+
'
|
15 |
+
quantized_by: TheBloke
|
16 |
+
---
|
17 |
+
<!-- markdownlint-disable MD041 -->
|
18 |
+
|
19 |
+
<!-- header start -->
|
20 |
+
<!-- 200823 -->
|
21 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
22 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
23 |
+
</div>
|
24 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
25 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
26 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
27 |
+
</div>
|
28 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
29 |
+
<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>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<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>
|
33 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
34 |
+
<!-- header end -->
|
35 |
+
|
36 |
+
# Dragon Yi 6B v0 - AWQ
|
37 |
+
- Model creator: [llmware](https://huggingface.co/llmware)
|
38 |
+
- Original model: [Dragon Yi 6B v0](https://huggingface.co/llmware/dragon-yi-6b-v0)
|
39 |
+
|
40 |
+
<!-- description start -->
|
41 |
+
## Description
|
42 |
+
|
43 |
+
This repo contains AWQ model files for [llmware's Dragon Yi 6B v0](https://huggingface.co/llmware/dragon-yi-6b-v0).
|
44 |
+
|
45 |
+
These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
|
46 |
+
|
47 |
+
|
48 |
+
### About AWQ
|
49 |
+
|
50 |
+
AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
|
51 |
+
|
52 |
+
It is supported by:
|
53 |
+
|
54 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
55 |
+
- [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
|
56 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
57 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
58 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
59 |
+
|
60 |
+
<!-- description end -->
|
61 |
+
<!-- repositories-available start -->
|
62 |
+
## Repositories available
|
63 |
+
|
64 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/dragon-yi-6B-v0-AWQ)
|
65 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/dragon-yi-6B-v0-GPTQ)
|
66 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/dragon-yi-6B-v0-GGUF)
|
67 |
+
* [llmware's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/llmware/dragon-yi-6b-v0)
|
68 |
+
<!-- repositories-available end -->
|
69 |
+
|
70 |
+
<!-- prompt-template start -->
|
71 |
+
## Prompt template: human-bot
|
72 |
+
|
73 |
+
```
|
74 |
+
<human>: {prompt}
|
75 |
+
<bot>:
|
76 |
+
|
77 |
+
```
|
78 |
+
|
79 |
+
<!-- prompt-template end -->
|
80 |
+
|
81 |
+
|
82 |
+
<!-- README_AWQ.md-provided-files start -->
|
83 |
+
## Provided files, and AWQ parameters
|
84 |
+
|
85 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
86 |
+
|
87 |
+
Models are released as sharded safetensors files.
|
88 |
+
|
89 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
90 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
91 |
+
| [main](https://huggingface.co/TheBloke/dragon-yi-6B-v0-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-raw-v1) | 4096 | 3.93 GB
|
92 |
+
|
93 |
+
<!-- README_AWQ.md-provided-files end -->
|
94 |
+
|
95 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
96 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
97 |
+
|
98 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
99 |
+
|
100 |
+
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.
|
101 |
+
|
102 |
+
1. Click the **Model tab**.
|
103 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/dragon-yi-6B-v0-AWQ`.
|
104 |
+
3. Click **Download**.
|
105 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
106 |
+
5. In the top left, click the refresh icon next to **Model**.
|
107 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `dragon-yi-6B-v0-AWQ`
|
108 |
+
7. Select **Loader: AutoAWQ**.
|
109 |
+
8. Click Load, and the model will load and is now ready for use.
|
110 |
+
9. 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.
|
111 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
112 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
113 |
+
|
114 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
115 |
+
## Multi-user inference server: vLLM
|
116 |
+
|
117 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
118 |
+
|
119 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
120 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
121 |
+
|
122 |
+
For example:
|
123 |
+
|
124 |
+
```shell
|
125 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/dragon-yi-6B-v0-AWQ --quantization awq --dtype auto
|
126 |
+
```
|
127 |
+
|
128 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
129 |
+
|
130 |
+
For example:
|
131 |
+
|
132 |
+
```python
|
133 |
+
from vllm import LLM, SamplingParams
|
134 |
+
|
135 |
+
prompts = [
|
136 |
+
"Tell me about AI",
|
137 |
+
"Write a story about llamas",
|
138 |
+
"What is 291 - 150?",
|
139 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
140 |
+
]
|
141 |
+
prompt_template=f'''<human>: {prompt}
|
142 |
+
<bot>:
|
143 |
+
'''
|
144 |
+
|
145 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
146 |
+
|
147 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
148 |
+
|
149 |
+
llm = LLM(model="TheBloke/dragon-yi-6B-v0-AWQ", quantization="awq", dtype="auto")
|
150 |
+
|
151 |
+
outputs = llm.generate(prompts, sampling_params)
|
152 |
+
|
153 |
+
# Print the outputs.
|
154 |
+
for output in outputs:
|
155 |
+
prompt = output.prompt
|
156 |
+
generated_text = output.outputs[0].text
|
157 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
158 |
+
```
|
159 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
160 |
+
|
161 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
162 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
163 |
+
|
164 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
165 |
+
|
166 |
+
Example Docker parameters:
|
167 |
+
|
168 |
+
```shell
|
169 |
+
--model-id TheBloke/dragon-yi-6B-v0-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
170 |
+
```
|
171 |
+
|
172 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
173 |
+
|
174 |
+
```shell
|
175 |
+
pip3 install huggingface-hub
|
176 |
+
```
|
177 |
+
|
178 |
+
```python
|
179 |
+
from huggingface_hub import InferenceClient
|
180 |
+
|
181 |
+
endpoint_url = "https://your-endpoint-url-here"
|
182 |
+
|
183 |
+
prompt = "Tell me about AI"
|
184 |
+
prompt_template=f'''<human>: {prompt}
|
185 |
+
<bot>:
|
186 |
+
'''
|
187 |
+
|
188 |
+
client = InferenceClient(endpoint_url)
|
189 |
+
response = client.text_generation(prompt,
|
190 |
+
max_new_tokens=128,
|
191 |
+
do_sample=True,
|
192 |
+
temperature=0.7,
|
193 |
+
top_p=0.95,
|
194 |
+
top_k=40,
|
195 |
+
repetition_penalty=1.1)
|
196 |
+
|
197 |
+
print(f"Model output: ", response)
|
198 |
+
```
|
199 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
200 |
+
|
201 |
+
<!-- README_AWQ.md-use-from-python start -->
|
202 |
+
## Inference from Python code using Transformers
|
203 |
+
|
204 |
+
### Install the necessary packages
|
205 |
+
|
206 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
207 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
208 |
+
|
209 |
+
```shell
|
210 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
211 |
+
```
|
212 |
+
|
213 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
214 |
+
|
215 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
216 |
+
|
217 |
+
```shell
|
218 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
219 |
+
```
|
220 |
+
|
221 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
222 |
+
|
223 |
+
```shell
|
224 |
+
pip3 uninstall -y autoawq
|
225 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
226 |
+
cd AutoAWQ
|
227 |
+
pip3 install .
|
228 |
+
```
|
229 |
+
|
230 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
231 |
+
|
232 |
+
```python
|
233 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
234 |
+
|
235 |
+
model_name_or_path = "TheBloke/dragon-yi-6B-v0-AWQ"
|
236 |
+
|
237 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
238 |
+
model = AutoModelForCausalLM.from_pretrained(
|
239 |
+
model_name_or_path,
|
240 |
+
low_cpu_mem_usage=True,
|
241 |
+
device_map="cuda:0"
|
242 |
+
)
|
243 |
+
|
244 |
+
# Using the text streamer to stream output one token at a time
|
245 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
246 |
+
|
247 |
+
prompt = "Tell me about AI"
|
248 |
+
prompt_template=f'''<human>: {prompt}
|
249 |
+
<bot>:
|
250 |
+
'''
|
251 |
+
|
252 |
+
# Convert prompt to tokens
|
253 |
+
tokens = tokenizer(
|
254 |
+
prompt_template,
|
255 |
+
return_tensors='pt'
|
256 |
+
).input_ids.cuda()
|
257 |
+
|
258 |
+
generation_params = {
|
259 |
+
"do_sample": True,
|
260 |
+
"temperature": 0.7,
|
261 |
+
"top_p": 0.95,
|
262 |
+
"top_k": 40,
|
263 |
+
"max_new_tokens": 512,
|
264 |
+
"repetition_penalty": 1.1
|
265 |
+
}
|
266 |
+
|
267 |
+
# Generate streamed output, visible one token at a time
|
268 |
+
generation_output = model.generate(
|
269 |
+
tokens,
|
270 |
+
streamer=streamer,
|
271 |
+
**generation_params
|
272 |
+
)
|
273 |
+
|
274 |
+
# Generation without a streamer, which will include the prompt in the output
|
275 |
+
generation_output = model.generate(
|
276 |
+
tokens,
|
277 |
+
**generation_params
|
278 |
+
)
|
279 |
+
|
280 |
+
# Get the tokens from the output, decode them, print them
|
281 |
+
token_output = generation_output[0]
|
282 |
+
text_output = tokenizer.decode(token_output)
|
283 |
+
print("model.generate output: ", text_output)
|
284 |
+
|
285 |
+
# Inference is also possible via Transformers' pipeline
|
286 |
+
from transformers import pipeline
|
287 |
+
|
288 |
+
pipe = pipeline(
|
289 |
+
"text-generation",
|
290 |
+
model=model,
|
291 |
+
tokenizer=tokenizer,
|
292 |
+
**generation_params
|
293 |
+
)
|
294 |
+
|
295 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
296 |
+
print("pipeline output: ", pipe_output)
|
297 |
+
|
298 |
+
```
|
299 |
+
<!-- README_AWQ.md-use-from-python end -->
|
300 |
+
|
301 |
+
<!-- README_AWQ.md-compatibility start -->
|
302 |
+
## Compatibility
|
303 |
+
|
304 |
+
The files provided are tested to work with:
|
305 |
+
|
306 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
307 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
308 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
309 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
310 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
311 |
+
|
312 |
+
<!-- README_AWQ.md-compatibility end -->
|
313 |
+
|
314 |
+
<!-- footer start -->
|
315 |
+
<!-- 200823 -->
|
316 |
+
## Discord
|
317 |
+
|
318 |
+
For further support, and discussions on these models and AI in general, join us at:
|
319 |
+
|
320 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
321 |
+
|
322 |
+
## Thanks, and how to contribute
|
323 |
+
|
324 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
325 |
+
|
326 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
327 |
+
|
328 |
+
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.
|
329 |
+
|
330 |
+
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.
|
331 |
+
|
332 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
333 |
+
|
334 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
335 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
336 |
+
|
337 |
+
**Special thanks to**: Aemon Algiz.
|
338 |
+
|
339 |
+
**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
|
340 |
+
|
341 |
+
|
342 |
+
Thank you to all my generous patrons and donaters!
|
343 |
+
|
344 |
+
And thank you again to a16z for their generous grant.
|
345 |
+
|
346 |
+
<!-- footer end -->
|
347 |
+
|
348 |
+
# Original model card: llmware's Dragon Yi 6B v0
|
349 |
+
|
350 |
+
|
351 |
+
# Model Card for Model ID
|
352 |
+
|
353 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
354 |
+
|
355 |
+
dragon-yi-6b-v0 part of the dRAGon ("Delivering RAG On ...") model series, RAG-instruct trained on top of a Yi-6B base model.
|
356 |
+
|
357 |
+
DRAGON models have been fine-tuned with the specific objective of fact-based question-answering over complex business and legal documents with an emphasis on reducing hallucinations and providing short, clear answers for workflow automation.
|
358 |
+
|
359 |
+
|
360 |
+
### Benchmark Tests
|
361 |
+
|
362 |
+
Evaluated against the benchmark test: [RAG-Instruct-Benchmark-Tester](https://www.huggingface.co/datasets/llmware/rag_instruct_benchmark_tester)
|
363 |
+
Average of 2 Test Runs with 1 point for correct answer, 0.5 point for partial correct or blank / NF, 0.0 points for incorrect, and -1 points for hallucinations.
|
364 |
+
|
365 |
+
--**Accuracy Score**: **99.5** correct out of 100
|
366 |
+
--Not Found Classification: 90.0%
|
367 |
+
--Boolean: 87.5%
|
368 |
+
--Math/Logic: 77.5%
|
369 |
+
--Complex Questions (1-5): 4 (Above Average)
|
370 |
+
--Summarization Quality (1-5): 4 (Above Average)
|
371 |
+
--Hallucinations: No hallucinations observed in test runs.
|
372 |
+
|
373 |
+
For test run results (and good indicator of target use cases), please see the files ("core_rag_test" and "answer_sheet" in this repo).
|
374 |
+
|
375 |
+
### Model Description
|
376 |
+
|
377 |
+
<!-- Provide a longer summary of what this model is. -->
|
378 |
+
|
379 |
+
- **Developed by:** llmware
|
380 |
+
- **Model type:** Yi
|
381 |
+
- **Language(s) (NLP):** English
|
382 |
+
- **License:** Yi License [Link](https://huggingface.co/01-ai/Yi-6B/blob/main/LICENSE)
|
383 |
+
- **Finetuned from model:** Yi-6B
|
384 |
+
|
385 |
+
|
386 |
+
### Direct Use
|
387 |
+
|
388 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
389 |
+
|
390 |
+
DRAGON is designed for enterprise automation use cases, especially in knowledge-intensive industries, such as financial services,
|
391 |
+
legal and regulatory industries with complex information sources.
|
392 |
+
|
393 |
+
DRAGON models have been trained for common RAG scenarios, specifically: question-answering, key-value extraction, and basic summarization as the core instruction types
|
394 |
+
without the need for a lot of complex instruction verbiage - provide a text passage context, ask questions, and get clear fact-based responses.
|
395 |
+
|
396 |
+
This model is licensed according to the terms of the license of the base model, Yi-6B, at this [link](https://huggingface.co/01-ai/Yi-6B/blob/main/LICENSE).
|
397 |
+
|
398 |
+
|
399 |
+
## Bias, Risks, and Limitations
|
400 |
+
|
401 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
402 |
+
|
403 |
+
Any model can provide inaccurate or incomplete information, and should be used in conjunction with appropriate safeguards and fact-checking mechanisms.
|
404 |
+
|
405 |
+
|
406 |
+
## How to Get Started with the Model
|
407 |
+
|
408 |
+
The fastest way to get started with BLING is through direct import in transformers:
|
409 |
+
|
410 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
411 |
+
tokenizer = AutoTokenizer.from_pretrained("dragon-yi-6b-v0")
|
412 |
+
model = AutoModelForCausalLM.from_pretrained("dragon-yi-6b-v0")
|
413 |
+
|
414 |
+
Please refer to the generation_test .py files in the Files repository, which includes 200 samples and script to test the model. The **generation_test_llmware_script.py** includes built-in llmware capabilities for fact-checking, as well as easy integration with document parsing and actual retrieval to swap out the test set for RAG workflow consisting of business documents.
|
415 |
+
|
416 |
+
The DRAGON model was fine-tuned with a simple "\<human> and \<bot> wrapper", so to get the best results, wrap inference entries as:
|
417 |
+
|
418 |
+
full_prompt = "<human>: " + my_prompt + "\n" + "<bot>:"
|
419 |
+
|
420 |
+
The BLING model was fine-tuned with closed-context samples, which assume generally that the prompt consists of two sub-parts:
|
421 |
+
|
422 |
+
1. Text Passage Context, and
|
423 |
+
2. Specific question or instruction based on the text passage
|
424 |
+
|
425 |
+
To get the best results, package "my_prompt" as follows:
|
426 |
+
|
427 |
+
my_prompt = {{text_passage}} + "\n" + {{question/instruction}}
|
428 |
+
|
429 |
+
|
430 |
+
If you are using a HuggingFace generation script:
|
431 |
+
|
432 |
+
# prepare prompt packaging used in fine-tuning process
|
433 |
+
new_prompt = "<human>: " + entries["context"] + "\n" + entries["query"] + "\n" + "<bot>:"
|
434 |
+
|
435 |
+
inputs = tokenizer(new_prompt, return_tensors="pt")
|
436 |
+
start_of_output = len(inputs.input_ids[0])
|
437 |
+
|
438 |
+
# temperature: set at 0.3 for consistency of output
|
439 |
+
# max_new_tokens: set at 100 - may prematurely stop a few of the summaries
|
440 |
+
|
441 |
+
outputs = model.generate(
|
442 |
+
inputs.input_ids.to(device),
|
443 |
+
eos_token_id=tokenizer.eos_token_id,
|
444 |
+
pad_token_id=tokenizer.eos_token_id,
|
445 |
+
do_sample=True,
|
446 |
+
temperature=0.3,
|
447 |
+
max_new_tokens=100,
|
448 |
+
)
|
449 |
+
|
450 |
+
output_only = tokenizer.decode(outputs[0][start_of_output:],skip_special_tokens=True)
|
451 |
+
|
452 |
+
|
453 |
+
## Model Card Contact
|
454 |
+
|
455 |
+
Darren Oberst & llmware team
|