fbaldassarri commited on
Commit
bca1a77
·
verified ·
1 Parent(s): 73c9c8f

Initial Upload

Browse files
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - es
5
+ - fr
6
+ - de
7
+ - pt
8
+ - ja
9
+ - it
10
+ - zh
11
+ - ko
12
+ - ar
13
+ - cs
14
+ - nl
15
+ pipeline_tag: text-generation
16
+ license: apache-2.0
17
+ library_name: transformers
18
+ tags:
19
+ - granite-3.3
20
+ - autoround
21
+ - auto-round
22
+ - intel-autoround
23
+ - intel
24
+ - woq
25
+ - gptq
26
+ - autogptq
27
+ - auto-gptq
28
+ - pytorch
29
+ - ibm
30
+ - granite
31
+ - granite-3
32
+ model_name: Granite 3.3 2b base
33
+ base_model:
34
+ - ibm-granite/granite-3.3-2b-base
35
+ inference: false
36
+ model_creator: ibm-granite
37
+ prompt_template: '{prompt}'
38
+ quantized_by: fbaldassarri
39
+ ---
40
+
41
+ ## Model Information
42
+
43
+ Quantized version of [ibm-granite/granite-3.3-2b-base](https://huggingface.co/fbaldassarri/ibm-granite/granite-3.3-2b-base) using torch.float32 for quantization tuning.
44
+ - 4 bits (INT4)
45
+ - group size = 64
46
+ - Asymmetrical Quantization
47
+ - Method AutoGPTQ
48
+
49
+ Quantization framework: [Intel AutoRound](https://github.com/intel/auto-round) v0.4.7
50
+
51
+ Note: this INT4 version of granite-3.3-2b-base has been quantized to run inference through CPU.
52
+
53
+ ## Replication Recipe
54
+
55
+ ### Step 1 Install Requirements
56
+
57
+ I suggest to install requirements into a dedicated python-virtualenv or a conda enviroment.
58
+
59
+ ```
60
+ wget https://github.com/intel/auto-round/archive/refs/tags/v0.4.7.tar.gz
61
+ tar -xvzf v0.4.7.tar.gz
62
+ cd auto-round-0.4.7
63
+ pip install -r requirements-cpu.txt --upgrade
64
+ ```
65
+
66
+ ### Step 2 Build Intel AutoRound wheel from sources
67
+
68
+ ```
69
+ pip install -vvv --no-build-isolation -e .[cpu]
70
+ ```
71
+
72
+ ### Step 3 Script for Quantization
73
+
74
+ ```
75
+ from transformers import AutoModelForCausalLM, AutoTokenizer
76
+ model_name = "ibm-granite/granite-3.3-2b-base"
77
+ model = AutoModelForCausalLM.from_pretrained(model_name)
78
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
79
+ from auto_round import AutoRound
80
+ bits, group_size, sym, device = 4, 64, False, 'cpu'
81
+ autoround = AutoRound(model, tokenizer, nsamples=128, iters=200, seqlen=512, batch_size=4, bits=bits, group_size=group_size, sym=sym, device=device)
82
+ autoround.quantize()
83
+ output_dir = "./AutoRound/ibm-granite_granite-3.3-2b-base-autogptq-int4-gs64-asym"
84
+ autoround.save_quantized(output_dir, format='auto_gptq', inplace=True)
85
+ ```
86
+
87
+ ## License
88
+
89
+ [Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/)
90
+
91
+ ## Disclaimer
92
+
93
+ This quantized model comes with no warrenty. It has been developed only for research purposes.
config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GraniteForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0,
7
+ "attention_multiplier": 0.015625,
8
+ "bos_token_id": 0,
9
+ "embedding_multiplier": 12.0,
10
+ "eos_token_id": 0,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2048,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 8192,
15
+ "logits_scaling": 8.0,
16
+ "max_position_embeddings": 131072,
17
+ "mlp_bias": false,
18
+ "model_type": "granite",
19
+ "num_attention_heads": 32,
20
+ "num_hidden_layers": 40,
21
+ "num_key_value_heads": 8,
22
+ "pad_token_id": 0,
23
+ "quantization_config": {
24
+ "act_bits": 16,
25
+ "act_data_type": "int",
26
+ "act_dynamic": true,
27
+ "act_group_size": 64,
28
+ "act_sym": false,
29
+ "amp": false,
30
+ "autoround_version": "0.4.7",
31
+ "batch_size": 4,
32
+ "bits": 4,
33
+ "damp_percent": 0.01,
34
+ "data_type": "int",
35
+ "desc_act": false,
36
+ "enable_minmax_tuning": true,
37
+ "enable_norm_bias_tuning": false,
38
+ "enable_quanted_input": true,
39
+ "gradient_accumulate_steps": 1,
40
+ "group_size": 64,
41
+ "iters": 200,
42
+ "low_gpu_mem_usage": false,
43
+ "lr": 0.005,
44
+ "minmax_lr": 0.005,
45
+ "nsamples": 128,
46
+ "quant_method": "gptq",
47
+ "scale_dtype": "torch.float16",
48
+ "seqlen": 512,
49
+ "super_bits": null,
50
+ "super_group_size": null,
51
+ "sym": false,
52
+ "to_quant_block_names": null,
53
+ "true_sequential": false
54
+ },
55
+ "residual_multiplier": 0.22,
56
+ "rms_norm_eps": 1e-05,
57
+ "rope_scaling": null,
58
+ "rope_theta": 10000000.0,
59
+ "tie_word_embeddings": true,
60
+ "torch_dtype": "float16",
61
+ "transformers_version": "4.51.2",
62
+ "use_cache": true,
63
+ "vocab_size": 49152
64
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.51.2"
7
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0de52e26ef83d0d8cac690dc1c2a46f07daa8a7d9d75a6742281610b98bf31c2
3
+ size 1718103264
quantize_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 4,
3
+ "group_size": 64,
4
+ "sym": false,
5
+ "data_type": "int",
6
+ "enable_quanted_input": true,
7
+ "enable_minmax_tuning": true,
8
+ "seqlen": 512,
9
+ "batch_size": 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
+ "to_quant_block_names": null,
19
+ "enable_norm_bias_tuning": false,
20
+ "act_bits": 16,
21
+ "act_group_size": 64,
22
+ "act_sym": false,
23
+ "act_dynamic": true,
24
+ "act_data_type": "int",
25
+ "super_bits": null,
26
+ "super_group_size": null,
27
+ "autoround_version": "0.4.7",
28
+ "quant_method": "gptq",
29
+ "desc_act": false,
30
+ "true_sequential": false,
31
+ "damp_percent": 0.01
32
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "<fim_prefix>",
5
+ "<fim_middle>",
6
+ "<fim_suffix>",
7
+ "<fim_pad>",
8
+ "<filename>",
9
+ "<gh_stars>",
10
+ "<issue_start>",
11
+ "<issue_comment>",
12
+ "<issue_closed>",
13
+ "<jupyter_start>",
14
+ "<jupyter_text>",
15
+ "<jupyter_code>",
16
+ "<jupyter_output>",
17
+ "<empty_output>",
18
+ "<commit_before>",
19
+ "<commit_msg>",
20
+ "<commit_after>",
21
+ "<reponame>"
22
+ ],
23
+ "bos_token": {
24
+ "content": "<|endoftext|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "eos_token": {
31
+ "content": "<|endoftext|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "pad_token": {
38
+ "content": "<|endoftext|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<|endoftext|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<fim_prefix>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<fim_middle>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<fim_suffix>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<fim_pad>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<filename>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<gh_stars>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<issue_start>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_comment>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_closed>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<jupyter_start>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_text>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_code>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_output>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<empty_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<commit_before>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<commit_msg>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ },
140
+ "17": {
141
+ "content": "<commit_after>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": true
147
+ },
148
+ "18": {
149
+ "content": "<reponame>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": true
155
+ }
156
+ },
157
+ "additional_special_tokens": [
158
+ "<|endoftext|>",
159
+ "<fim_prefix>",
160
+ "<fim_middle>",
161
+ "<fim_suffix>",
162
+ "<fim_pad>",
163
+ "<filename>",
164
+ "<gh_stars>",
165
+ "<issue_start>",
166
+ "<issue_comment>",
167
+ "<issue_closed>",
168
+ "<jupyter_start>",
169
+ "<jupyter_text>",
170
+ "<jupyter_code>",
171
+ "<jupyter_output>",
172
+ "<empty_output>",
173
+ "<commit_before>",
174
+ "<commit_msg>",
175
+ "<commit_after>",
176
+ "<reponame>"
177
+ ],
178
+ "bos_token": "<|endoftext|>",
179
+ "clean_up_tokenization_spaces": true,
180
+ "eos_token": "<|endoftext|>",
181
+ "extra_special_tokens": {},
182
+ "model_max_length": 9223372036854775807,
183
+ "pad_token": "<|endoftext|>",
184
+ "padding_side": "left",
185
+ "tokenizer_class": "GPT2Tokenizer",
186
+ "unk_token": "<|endoftext|>",
187
+ "vocab_size": 49152
188
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff