fbaldassarri
commited on
Commit
•
c599821
1
Parent(s):
dc364bf
Initial Upload
Browse files- README.md +86 -3
- config.json +55 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- quantize_config.json +25 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +42 -0
README.md
CHANGED
@@ -1,3 +1,86 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- pytorch
|
6 |
+
- causal-lm
|
7 |
+
- tinyllama
|
8 |
+
- autoround
|
9 |
+
- autogptq
|
10 |
+
- intel
|
11 |
+
- gptq
|
12 |
+
- woq
|
13 |
+
license: apache-2.0
|
14 |
+
model_name: TinyLlama 1.1B v1.1
|
15 |
+
base_model: TinyLlama/TinyLlama_v1.1
|
16 |
+
inference: false
|
17 |
+
model_creator: TinyLlama
|
18 |
+
datasets:
|
19 |
+
- cerebras/SlimPajama-627B
|
20 |
+
pipeline_tag: text-generation
|
21 |
+
prompt_template: '{prompt}
|
22 |
+
'
|
23 |
+
quantized_by: fbaldassarri
|
24 |
+
---
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
## Model Information
|
29 |
+
|
30 |
+
Quantized version of [TinyLlama 1.1B v1.1](https://huggingface.co/TinyLlama/TinyLlama_v1.1/) using torch.float32 for quantization tuning.
|
31 |
+
- 4 bits (INT4)
|
32 |
+
- group size = 128
|
33 |
+
- Asymmetrical Quantization
|
34 |
+
- Method AutoGPTQ
|
35 |
+
|
36 |
+
Quantization framework: [Intel AutoRound](https://github.com/intel/auto-round)
|
37 |
+
|
38 |
+
Note: this INT4 version of TinyLlama 1.1B v1.1 has been quantized to run inference through CPU.
|
39 |
+
|
40 |
+
## Replication Recipe
|
41 |
+
|
42 |
+
### Step 1 Install Requirements
|
43 |
+
|
44 |
+
I suggest to install requirements into a dedicated python-virtualenv or a conda enviroment.
|
45 |
+
|
46 |
+
```
|
47 |
+
python -m pip install <package> --upgrade
|
48 |
+
```
|
49 |
+
|
50 |
+
- accelerate==1.0.1
|
51 |
+
- auto_gptq==0.7.1
|
52 |
+
- neural_compressor==3.1
|
53 |
+
- torch==2.3.0+cpu
|
54 |
+
- torchaudio==2.5.0+cpu
|
55 |
+
- torchvision==0.18.0+cpu
|
56 |
+
- transformers==4.45.2
|
57 |
+
|
58 |
+
### Step 2 Build Intel Autoround wheel from sources
|
59 |
+
|
60 |
+
```
|
61 |
+
python -m pip install git+https://github.com/intel/auto-round.git
|
62 |
+
```
|
63 |
+
|
64 |
+
### Step 3 Script for Quantization
|
65 |
+
|
66 |
+
```
|
67 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
68 |
+
model_name = "TinyLlama/TinyLlama_v1.1"
|
69 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
70 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
71 |
+
from auto_round import AutoRound
|
72 |
+
bits, group_size, sym = 4, 128, False
|
73 |
+
autoround = AutoRound(model, tokenizer, nsamples=128, iters=200, seqlen=512, batch_size=4, bits=bits, group_size=group_size, sym=sym)
|
74 |
+
autoround.quantize()
|
75 |
+
output_dir = "./AutoRound/TinyLlama_TinyLlama_v1.1-autogptq-int4-gs128-asym"
|
76 |
+
autoround.save_quantized(output_dir, format='auto_gptq', inplace=True)
|
77 |
+
```
|
78 |
+
|
79 |
+
## License
|
80 |
+
|
81 |
+
[Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/)
|
82 |
+
|
83 |
+
## Disclaimer
|
84 |
+
|
85 |
+
This quantized model comes with no warrenty. It has been developed only for research purposes.
|
86 |
+
|
config.json
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "TinyLlama/TinyLlama_v1.1",
|
3 |
+
"architectures": [
|
4 |
+
"LlamaForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_bias": false,
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"bos_token_id": 1,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"head_dim": 64,
|
11 |
+
"hidden_act": "silu",
|
12 |
+
"hidden_size": 2048,
|
13 |
+
"initializer_range": 0.02,
|
14 |
+
"intermediate_size": 5632,
|
15 |
+
"max_position_embeddings": 2048,
|
16 |
+
"mlp_bias": false,
|
17 |
+
"model_type": "llama",
|
18 |
+
"num_attention_heads": 32,
|
19 |
+
"num_hidden_layers": 22,
|
20 |
+
"num_key_value_heads": 4,
|
21 |
+
"pretraining_tp": 1,
|
22 |
+
"quantization_config": {
|
23 |
+
"amp": false,
|
24 |
+
"autoround_version": "0.4.0.dev",
|
25 |
+
"bits": 4,
|
26 |
+
"damp_percent": 0.01,
|
27 |
+
"data_type": "int",
|
28 |
+
"desc_act": false,
|
29 |
+
"enable_minmax_tuning": true,
|
30 |
+
"enable_norm_bias_tuning": false,
|
31 |
+
"enable_quanted_input": true,
|
32 |
+
"gradient_accumulate_steps": 1,
|
33 |
+
"group_size": 128,
|
34 |
+
"iters": 200,
|
35 |
+
"low_gpu_mem_usage": false,
|
36 |
+
"lr": 0.005,
|
37 |
+
"minmax_lr": 0.005,
|
38 |
+
"nsamples": 128,
|
39 |
+
"quant_block_list": null,
|
40 |
+
"quant_method": "gptq",
|
41 |
+
"scale_dtype": "torch.float16",
|
42 |
+
"seqlen": 512,
|
43 |
+
"sym": false,
|
44 |
+
"train_bs": 4,
|
45 |
+
"true_sequential": false
|
46 |
+
},
|
47 |
+
"rms_norm_eps": 1e-05,
|
48 |
+
"rope_scaling": null,
|
49 |
+
"rope_theta": 10000.0,
|
50 |
+
"tie_word_embeddings": false,
|
51 |
+
"torch_dtype": "float32",
|
52 |
+
"transformers_version": "4.45.2",
|
53 |
+
"use_cache": true,
|
54 |
+
"vocab_size": 32000
|
55 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token_id": 1,
|
3 |
+
"eos_token_id": 2,
|
4 |
+
"max_length": 2048,
|
5 |
+
"pad_token_id": 0,
|
6 |
+
"transformers_version": "4.45.2"
|
7 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfbf528bac3b39975d8636f713e0919ebec55561bee41ef9b3617188c6e3a7c1
|
3 |
+
size 1028884248
|
quantize_config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bits": 4,
|
3 |
+
"group_size": 128,
|
4 |
+
"sym": false,
|
5 |
+
"data_type": "int",
|
6 |
+
"enable_quanted_input": true,
|
7 |
+
"enable_minmax_tuning": true,
|
8 |
+
"seqlen": 512,
|
9 |
+
"train_bs": 4,
|
10 |
+
"scale_dtype": "torch.float16",
|
11 |
+
"lr": 0.005,
|
12 |
+
"minmax_lr": 0.005,
|
13 |
+
"gradient_accumulate_steps": 1,
|
14 |
+
"iters": 200,
|
15 |
+
"amp": false,
|
16 |
+
"nsamples": 128,
|
17 |
+
"low_gpu_mem_usage": false,
|
18 |
+
"quant_block_list": null,
|
19 |
+
"enable_norm_bias_tuning": false,
|
20 |
+
"autoround_version": "0.4.0.dev",
|
21 |
+
"quant_method": "gptq",
|
22 |
+
"desc_act": false,
|
23 |
+
"true_sequential": false,
|
24 |
+
"damp_percent": 0.01
|
25 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"unk_token": {
|
17 |
+
"content": "<unk>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": null,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"0": {
|
7 |
+
"content": "<unk>",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": false,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": true
|
13 |
+
},
|
14 |
+
"1": {
|
15 |
+
"content": "<s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": false,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": true
|
21 |
+
},
|
22 |
+
"2": {
|
23 |
+
"content": "</s>",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": false,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": true
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"bos_token": "<s>",
|
32 |
+
"clean_up_tokenization_spaces": false,
|
33 |
+
"eos_token": "</s>",
|
34 |
+
"legacy": false,
|
35 |
+
"model_max_length": 1000000000000000019884624838656,
|
36 |
+
"pad_token": null,
|
37 |
+
"padding_side": "right",
|
38 |
+
"sp_model_kwargs": {},
|
39 |
+
"tokenizer_class": "LlamaTokenizer",
|
40 |
+
"unk_token": "<unk>",
|
41 |
+
"use_default_system_prompt": false
|
42 |
+
}
|