TheBloke commited on
Commit
c7973dd
1 Parent(s): 90c948f

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +409 -0
README.md ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: maritaca-ai/sabia-7b
3
+ inference: false
4
+ language:
5
+ - pt
6
+ license: other
7
+ model_creator: Maritaca AI
8
+ model_name: Sabia 7B
9
+ model_type: llama
10
+ prompt_template: '{prompt}
11
+
12
+ '
13
+ quantized_by: TheBloke
14
+ ---
15
+ <!-- markdownlint-disable MD041 -->
16
+
17
+ <!-- header start -->
18
+ <!-- 200823 -->
19
+ <div style="width: auto; margin-left: auto; margin-right: auto">
20
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
21
+ </div>
22
+ <div style="display: flex; justify-content: space-between; width: 100%;">
23
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
24
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
25
+ </div>
26
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
27
+ <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>
28
+ </div>
29
+ </div>
30
+ <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>
31
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
32
+ <!-- header end -->
33
+
34
+ # Sabia 7B - AWQ
35
+ - Model creator: [Maritaca AI](https://huggingface.co/maritaca-ai)
36
+ - Original model: [Sabia 7B](https://huggingface.co/maritaca-ai/sabia-7b)
37
+
38
+ <!-- description start -->
39
+ ## Description
40
+
41
+ This repo contains AWQ model files for [Maritaca AI's Sabia 7B](https://huggingface.co/maritaca-ai/sabia-7b).
42
+
43
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
44
+
45
+
46
+ ### About AWQ
47
+
48
+ 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.
49
+
50
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
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) - version 0.2.2 or later for support for all model types.
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/sabia-7B-AWQ)
65
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/sabia-7B-GPTQ)
66
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/sabia-7B-GGUF)
67
+ * [Maritaca AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/maritaca-ai/sabia-7b)
68
+ <!-- repositories-available end -->
69
+
70
+ <!-- prompt-template start -->
71
+ ## Prompt template: None
72
+
73
+ ```
74
+ {prompt}
75
+
76
+ ```
77
+
78
+ <!-- prompt-template end -->
79
+
80
+
81
+ <!-- README_AWQ.md-provided-files start -->
82
+ ## Provided files, and AWQ parameters
83
+
84
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
85
+
86
+ Models are released as sharded safetensors files.
87
+
88
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
89
+ | ------ | ---- | -- | ----------- | ------- | ---- |
90
+ | [main](https://huggingface.co/TheBloke/sabia-7B-AWQ/tree/main) | 4 | 128 | [Portuguese Orca](https://huggingface.co/datasets/adalbertojunior/portuguese_orca/viewer/) | 2048 | 3.89 GB
91
+
92
+ <!-- README_AWQ.md-provided-files end -->
93
+
94
+ <!-- README_AWQ.md-text-generation-webui start -->
95
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
96
+
97
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
98
+
99
+ 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.
100
+
101
+ 1. Click the **Model tab**.
102
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/sabia-7B-AWQ`.
103
+ 3. Click **Download**.
104
+ 4. The model will start downloading. Once it's finished it will say "Done".
105
+ 5. In the top left, click the refresh icon next to **Model**.
106
+ 6. In the **Model** dropdown, choose the model you just downloaded: `sabia-7B-AWQ`
107
+ 7. Select **Loader: AutoAWQ**.
108
+ 8. Click Load, and the model will load and is now ready for use.
109
+ 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.
110
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
111
+ <!-- README_AWQ.md-text-generation-webui end -->
112
+
113
+ <!-- README_AWQ.md-use-from-vllm start -->
114
+ ## Multi-user inference server: vLLM
115
+
116
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
117
+
118
+ - Please ensure you are using vLLM version 0.2 or later.
119
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
120
+
121
+ For example:
122
+
123
+ ```shell
124
+ python3 -m vllm.entrypoints.api_server --model TheBloke/sabia-7B-AWQ --quantization awq --dtype auto
125
+ ```
126
+
127
+ - When using vLLM from Python code, again set `quantization=awq`.
128
+
129
+ For example:
130
+
131
+ ```python
132
+ from vllm import LLM, SamplingParams
133
+
134
+ prompts = [
135
+ "Tell me about AI",
136
+ "Write a story about llamas",
137
+ "What is 291 - 150?",
138
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
139
+ ]
140
+ prompt_template=f'''{prompt}
141
+ '''
142
+
143
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
144
+
145
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
146
+
147
+ llm = LLM(model="TheBloke/sabia-7B-AWQ", quantization="awq", dtype="auto")
148
+
149
+ outputs = llm.generate(prompts, sampling_params)
150
+
151
+ # Print the outputs.
152
+ for output in outputs:
153
+ prompt = output.prompt
154
+ generated_text = output.outputs[0].text
155
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
156
+ ```
157
+ <!-- README_AWQ.md-use-from-vllm start -->
158
+
159
+ <!-- README_AWQ.md-use-from-tgi start -->
160
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
161
+
162
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
163
+
164
+ Example Docker parameters:
165
+
166
+ ```shell
167
+ --model-id TheBloke/sabia-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
168
+ ```
169
+
170
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
171
+
172
+ ```shell
173
+ pip3 install huggingface-hub
174
+ ```
175
+
176
+ ```python
177
+ from huggingface_hub import InferenceClient
178
+
179
+ endpoint_url = "https://your-endpoint-url-here"
180
+
181
+ prompt = "Tell me about AI"
182
+ prompt_template=f'''{prompt}
183
+ '''
184
+
185
+ client = InferenceClient(endpoint_url)
186
+ response = client.text_generation(prompt,
187
+ max_new_tokens=128,
188
+ do_sample=True,
189
+ temperature=0.7,
190
+ top_p=0.95,
191
+ top_k=40,
192
+ repetition_penalty=1.1)
193
+
194
+ print(f"Model output: ", response)
195
+ ```
196
+ <!-- README_AWQ.md-use-from-tgi end -->
197
+
198
+ <!-- README_AWQ.md-use-from-python start -->
199
+ ## Inference from Python code using Transformers
200
+
201
+ ### Install the necessary packages
202
+
203
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
204
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
205
+
206
+ ```shell
207
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
208
+ ```
209
+
210
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
211
+
212
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
213
+
214
+ ```shell
215
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
216
+ ```
217
+
218
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
219
+
220
+ ```shell
221
+ pip3 uninstall -y autoawq
222
+ git clone https://github.com/casper-hansen/AutoAWQ
223
+ cd AutoAWQ
224
+ pip3 install .
225
+ ```
226
+
227
+ ### Transformers example code (requires Transformers 4.35.0 and later)
228
+
229
+ ```python
230
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
231
+
232
+ model_name_or_path = "TheBloke/sabia-7B-AWQ"
233
+
234
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
235
+ model = AutoModelForCausalLM.from_pretrained(
236
+ model_name_or_path,
237
+ low_cpu_mem_usage=True,
238
+ device_map="cuda:0"
239
+ )
240
+
241
+ # Using the text streamer to stream output one token at a time
242
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
243
+
244
+ prompt = "Tell me about AI"
245
+ prompt_template=f'''{prompt}
246
+ '''
247
+
248
+ # Convert prompt to tokens
249
+ tokens = tokenizer(
250
+ prompt_template,
251
+ return_tensors='pt'
252
+ ).input_ids.cuda()
253
+
254
+ generation_params = {
255
+ "do_sample": True,
256
+ "temperature": 0.7,
257
+ "top_p": 0.95,
258
+ "top_k": 40,
259
+ "max_new_tokens": 512,
260
+ "repetition_penalty": 1.1
261
+ }
262
+
263
+ # Generate streamed output, visible one token at a time
264
+ generation_output = model.generate(
265
+ tokens,
266
+ streamer=streamer,
267
+ **generation_params
268
+ )
269
+
270
+ # Generation without a streamer, which will include the prompt in the output
271
+ generation_output = model.generate(
272
+ tokens,
273
+ **generation_params
274
+ )
275
+
276
+ # Get the tokens from the output, decode them, print them
277
+ token_output = generation_output[0]
278
+ text_output = tokenizer.decode(token_output)
279
+ print("model.generate output: ", text_output)
280
+
281
+ # Inference is also possible via Transformers' pipeline
282
+ from transformers import pipeline
283
+
284
+ pipe = pipeline(
285
+ "text-generation",
286
+ model=model,
287
+ tokenizer=tokenizer,
288
+ **generation_params
289
+ )
290
+
291
+ pipe_output = pipe(prompt_template)[0]['generated_text']
292
+ print("pipeline output: ", pipe_output)
293
+
294
+ ```
295
+ <!-- README_AWQ.md-use-from-python end -->
296
+
297
+ <!-- README_AWQ.md-compatibility start -->
298
+ ## Compatibility
299
+
300
+ The files provided are tested to work with:
301
+
302
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
303
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
304
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
305
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
306
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
307
+
308
+ <!-- README_AWQ.md-compatibility end -->
309
+
310
+ <!-- footer start -->
311
+ <!-- 200823 -->
312
+ ## Discord
313
+
314
+ For further support, and discussions on these models and AI in general, join us at:
315
+
316
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
317
+
318
+ ## Thanks, and how to contribute
319
+
320
+ Thanks to the [chirper.ai](https://chirper.ai) team!
321
+
322
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
323
+
324
+ 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.
325
+
326
+ 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.
327
+
328
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
329
+
330
+ * Patreon: https://patreon.com/TheBlokeAI
331
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
332
+
333
+ **Special thanks to**: Aemon Algiz.
334
+
335
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
336
+
337
+
338
+ Thank you to all my generous patrons and donaters!
339
+
340
+ And thank you again to a16z for their generous grant.
341
+
342
+ <!-- footer end -->
343
+
344
+ # Original model card: Maritaca AI's Sabia 7B
345
+
346
+
347
+ Sabiá-7B is Portuguese language model developed by [Maritaca AI](https://www.maritaca.ai/).
348
+
349
+ **Input:** The model accepts only text input.
350
+
351
+ **Output:** The Model generates text only.
352
+
353
+ **Model Architecture:** Sabiá-7B is an auto-regressive language model that uses the same architecture of LLaMA-1-7B.
354
+
355
+ **Tokenizer:** It uses the same tokenizer as LLaMA-1-7B.
356
+
357
+ **Maximum sequence length:** 2048 tokens.
358
+
359
+ **Pretraining data:** The model was pretrained on 7 billion tokens from the Portuguese subset of ClueWeb22, starting with the weights of LLaMA-1-7B and further trained for an additional 10 billion tokens, approximately 1.4 epochs of the training dataset.
360
+
361
+ **Data Freshness:** The pretraining data has a cutoff of mid-2022.
362
+
363
+ **License:** The licensing is the same as LLaMA-1's, restricting the model's use to research purposes only.
364
+
365
+ **Paper:** For more details, please refer to our paper: [Sabiá: Portuguese Large Language Models](https://arxiv.org/pdf/2304.07880.pdf)
366
+
367
+ Given that Sabiá-7B was trained solely on a language modeling objective without fine-tuning for instruction following, it is recommended for few-shot tasks rather than zero-shot tasks.
368
+
369
+ **Results in Portuguese**
370
+
371
+ Below we show the results on the Poeta benchmark, which consists of 14 Portuguese datasets.
372
+
373
+ For more information on the Normalized Preferred Metric (NPM), please refer to our paper.
374
+
375
+ |Model | NPM |
376
+ |--|--|
377
+ |LLaMA-1-7B| 33.0|
378
+ |LLaMA-2-7B| 43.7|
379
+ |Sabiá-7B| 48.5|
380
+
381
+ **Results in English**
382
+
383
+ Below we show the average results on 6 English datasets: PIQA, HellaSwag, WinoGrande, ARC-e, ARC-c, and OpenBookQA.
384
+
385
+ |Model | NPM |
386
+ |--|--|
387
+ |LLaMA-1-7B| 50.1|
388
+ |Sabiá-7B| 49.0|
389
+
390
+
391
+
392
+ Please use the following bibtex to cite our paper:
393
+ ```
394
+ @InProceedings{10.1007/978-3-031-45392-2_15,
395
+ author="Pires, Ramon
396
+ and Abonizio, Hugo
397
+ and Almeida, Thales Sales
398
+ and Nogueira, Rodrigo",
399
+ editor="Naldi, Murilo C.
400
+ and Bianchi, Reinaldo A. C.",
401
+ title="Sabi{\'a}: Portuguese Large Language Models",
402
+ booktitle="Intelligent Systems",
403
+ year="2023",
404
+ publisher="Springer Nature Switzerland",
405
+ address="Cham",
406
+ pages="226--240",
407
+ isbn="978-3-031-45392-2"
408
+ }
409
+ ```