onebitquantized
commited on
Commit
•
04ea4b7
1
Parent(s):
4a8b5e9
Upload of AutoGPTQ quantized model
Browse files- README.md +21 -11
- config.json +3 -3
- gptq_model-4bit-128g.safetensors +3 -0
- quantize_config.json +3 -3
README.md
CHANGED
@@ -1,22 +1,37 @@
|
|
1 |
---
|
2 |
-
base_model:
|
3 |
-
- meta-llama/Llama-3.2-3B-Instruct
|
4 |
library_name: transformers
|
5 |
license: llama3.2
|
|
|
|
|
6 |
---
|
7 |
|
8 |
# This model has been xMADified!
|
9 |
|
10 |
This repository contains [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) quantized from 16-bit floats to 4-bit integers, using xMAD.ai proprietary technology.
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# How to Run Model
|
13 |
|
14 |
Loading the model checkpoint of this xMADified model requires less than 3 GiB of VRAM. Hence it can be efficiently run on most laptop GPUs.
|
15 |
|
16 |
**Package prerequisites**: Run the following commands to install the required packages.
|
17 |
```bash
|
18 |
-
pip install
|
19 |
-
pip install
|
|
|
20 |
```
|
21 |
|
22 |
**Sample Inference Code**
|
@@ -24,15 +39,12 @@ pip install -q --no-build-isolation auto-gptq
|
|
24 |
```python
|
25 |
from transformers import AutoTokenizer
|
26 |
from auto_gptq import AutoGPTQForCausalLM
|
27 |
-
|
28 |
-
model_id = "xmadai/Llama-3.2-3B-Instruct-xMADai-4bit"
|
29 |
prompt = [
|
30 |
{"role": "system", "content": "You are a helpful assistant, that responds as a pirate."},
|
31 |
{"role": "user", "content": "What's Deep Learning?"},
|
32 |
]
|
33 |
-
|
34 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
35 |
-
|
36 |
inputs = tokenizer.apply_chat_template(
|
37 |
prompt,
|
38 |
tokenize=True,
|
@@ -40,15 +52,13 @@ inputs = tokenizer.apply_chat_template(
|
|
40 |
return_tensors="pt",
|
41 |
return_dict=True,
|
42 |
).to("cuda")
|
43 |
-
|
44 |
model = AutoGPTQForCausalLM.from_quantized(
|
45 |
model_id,
|
46 |
device_map='auto',
|
47 |
trust_remote_code=True,
|
48 |
)
|
49 |
-
|
50 |
outputs = model.generate(**inputs, do_sample=True, max_new_tokens=256)
|
51 |
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
52 |
```
|
53 |
|
54 |
-
For additional xMADified models, access to fine-tuning, and general questions, please contact us at [email protected] and join our waiting list.
|
|
|
1 |
---
|
|
|
|
|
2 |
library_name: transformers
|
3 |
license: llama3.2
|
4 |
+
base_model:
|
5 |
+
- meta-llama/Llama-3.2-3B-Instruct
|
6 |
---
|
7 |
|
8 |
# This model has been xMADified!
|
9 |
|
10 |
This repository contains [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) quantized from 16-bit floats to 4-bit integers, using xMAD.ai proprietary technology.
|
11 |
|
12 |
+
|
13 |
+
# Why should I use this model?
|
14 |
+
1. **Accuracy**: This xMADified model is the best quantized version of the `meta-llama/Llama-3.2-3B-Instruct` model. We are on par with the original (fp16) model (see _Table 1_ below).
|
15 |
+
|
16 |
+
2. **Memory-efficiency**: This xMADified model (3 GB) is >50% less memory than the full-precision model (6.5 GB). You can run this on any laptop GPU.
|
17 |
+
|
18 |
+
3. **Fine-tuning**: These models are fine-tunable over the same reduced (3 GB) hardware in mere 3-clicks. Watch our product demo [here](https://www.youtube.com/watch?v=S0wX32kT90s&list=TLGGL9fvmJ-d4xsxODEwMjAyNA)
|
19 |
+
## Table 1: xMAD vs. Meta
|
20 |
+
|
21 |
+
| | MMLU | Arc Challenge | Arc Easy | LAMBADA Standard | LAMBADA OpenAI | PIQA | Winogrande | HellaSwag |
|
22 |
+
| ----------------------------------------------------------------------------------------------------------- | --------- | ------------- | --------- | ---------------- | -------------- | --------- | ---------- | --------- |
|
23 |
+
| [xmadai/Llama-3.2-3B-Instruct-xMADai-INT4](https://huggingface.co/xmadai/Llama-3.2-3B-Instruct-xMADai-INT4) | **58.60** | **39.93** | **72.10** | **53.77** | **62.49** | **74.27** | **63.69** | **51.28** |
|
24 |
+
| [meta-llama/Llama-3.2-3B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) | 60.48 | 43.69 | 74.24 | 57.75 | 66.54 | 75.73 | 67.40 | 52.20 |
|
25 |
+
|
26 |
# How to Run Model
|
27 |
|
28 |
Loading the model checkpoint of this xMADified model requires less than 3 GiB of VRAM. Hence it can be efficiently run on most laptop GPUs.
|
29 |
|
30 |
**Package prerequisites**: Run the following commands to install the required packages.
|
31 |
```bash
|
32 |
+
pip install torch==2.4.0 # Run following if you have CUDA version 11.8: pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu118
|
33 |
+
pip install transformers accelerate optimum
|
34 |
+
pip install -vvv --no-build-isolation "git+https://github.com/PanQiWei/[email protected]"
|
35 |
```
|
36 |
|
37 |
**Sample Inference Code**
|
|
|
39 |
```python
|
40 |
from transformers import AutoTokenizer
|
41 |
from auto_gptq import AutoGPTQForCausalLM
|
42 |
+
model_id = "xmadai/Llama-3.2-3B-Instruct-xMADai-INT4"
|
|
|
43 |
prompt = [
|
44 |
{"role": "system", "content": "You are a helpful assistant, that responds as a pirate."},
|
45 |
{"role": "user", "content": "What's Deep Learning?"},
|
46 |
]
|
|
|
47 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
|
48 |
inputs = tokenizer.apply_chat_template(
|
49 |
prompt,
|
50 |
tokenize=True,
|
|
|
52 |
return_tensors="pt",
|
53 |
return_dict=True,
|
54 |
).to("cuda")
|
|
|
55 |
model = AutoGPTQForCausalLM.from_quantized(
|
56 |
model_id,
|
57 |
device_map='auto',
|
58 |
trust_remote_code=True,
|
59 |
)
|
|
|
60 |
outputs = model.generate(**inputs, do_sample=True, max_new_tokens=256)
|
61 |
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
62 |
```
|
63 |
|
64 |
+
For additional xMADified models, access to fine-tuning, and general questions, please contact us at [email protected] and join our waiting list.
|
config.json
CHANGED
@@ -26,14 +26,14 @@
|
|
26 |
"quantization_config": {
|
27 |
"bits": 4,
|
28 |
"checkpoint_format": "gptq",
|
29 |
-
"damp_percent": 0.
|
30 |
"desc_act": true,
|
31 |
"exponent_hinv": 4.0,
|
32 |
-
"group_size":
|
33 |
"model_file_base_name": null,
|
34 |
"model_name_or_path": null,
|
35 |
"quant_method": "gptq",
|
36 |
-
"shrink": 0.
|
37 |
"static_groups": false,
|
38 |
"sym": false,
|
39 |
"true_sequential": true
|
|
|
26 |
"quantization_config": {
|
27 |
"bits": 4,
|
28 |
"checkpoint_format": "gptq",
|
29 |
+
"damp_percent": 0.05,
|
30 |
"desc_act": true,
|
31 |
"exponent_hinv": 4.0,
|
32 |
+
"group_size": 128,
|
33 |
"model_file_base_name": null,
|
34 |
"model_name_or_path": null,
|
35 |
"quant_method": "gptq",
|
36 |
+
"shrink": 0.0001,
|
37 |
"static_groups": false,
|
38 |
"sym": false,
|
39 |
"true_sequential": true
|
gptq_model-4bit-128g.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:91ea6d47c866319bf44774967e13a2035901de68c9a457354552e52bb9a46093
|
3 |
+
size 3043772416
|
quantize_config.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"bits": 4,
|
3 |
-
"group_size":
|
4 |
-
"damp_percent": 0.
|
5 |
"desc_act": true,
|
6 |
"static_groups": false,
|
7 |
"sym": false,
|
@@ -9,7 +9,7 @@
|
|
9 |
"model_name_or_path": null,
|
10 |
"model_file_base_name": null,
|
11 |
"exponent_hinv": 4.0,
|
12 |
-
"shrink": 0.
|
13 |
"quant_method": "gptq",
|
14 |
"checkpoint_format": "gptq"
|
15 |
}
|
|
|
1 |
{
|
2 |
"bits": 4,
|
3 |
+
"group_size": 128,
|
4 |
+
"damp_percent": 0.05,
|
5 |
"desc_act": true,
|
6 |
"static_groups": false,
|
7 |
"sym": false,
|
|
|
9 |
"model_name_or_path": null,
|
10 |
"model_file_base_name": null,
|
11 |
"exponent_hinv": 4.0,
|
12 |
+
"shrink": 0.0001,
|
13 |
"quant_method": "gptq",
|
14 |
"checkpoint_format": "gptq"
|
15 |
}
|