fbaldassarri
commited on
Initial Upload
Browse files- README.md +84 -3
- config.json +52 -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 +43 -0
README.md
CHANGED
@@ -1,3 +1,84 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- it
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- pretrained
|
7 |
+
- pytorch
|
8 |
+
- causal-lm
|
9 |
+
- minerva
|
10 |
+
- autoround
|
11 |
+
- intel-autoround
|
12 |
+
- woq
|
13 |
+
- gptq
|
14 |
+
- autogptq
|
15 |
+
- auto-gptq
|
16 |
+
- intel
|
17 |
+
license: apache-2.0
|
18 |
+
model_name: Minerva 3B base v1.0
|
19 |
+
base_model:
|
20 |
+
- sapienzanlp/Minerva-3B-base-v1.0
|
21 |
+
inference: false
|
22 |
+
model_creator: sapienzanlp
|
23 |
+
datasets:
|
24 |
+
- uonlp/CulturaX
|
25 |
+
pipeline_tag: text-generation
|
26 |
+
prompt_template: '{prompt}
|
27 |
+
'
|
28 |
+
quantized_by: fbaldassarri
|
29 |
+
---
|
30 |
+
|
31 |
+
## Model Information
|
32 |
+
|
33 |
+
Quantized version of [sapienzanlp/Minerva-3B-base-v1.0](https://huggingface.co/sapienzanlp/Minerva-3B-base-v1.0) using torch.float32 for quantization tuning.
|
34 |
+
- 4 bits (INT4)
|
35 |
+
- group size = 128
|
36 |
+
- Asymmetrical Quantization
|
37 |
+
- Method AutoGPTQ
|
38 |
+
|
39 |
+
Quantization framework: [Intel AutoRound](https://github.com/intel/auto-round) v0.4.3
|
40 |
+
|
41 |
+
Note: this INT4 version of Minerva-3B-base-v1.0 has been quantized to run inference through CPU.
|
42 |
+
|
43 |
+
## Replication Recipe
|
44 |
+
|
45 |
+
### Step 1 Install Requirements
|
46 |
+
|
47 |
+
I suggest to install requirements into a dedicated python-virtualenv or a conda enviroment.
|
48 |
+
|
49 |
+
```
|
50 |
+
wget https://github.com/intel/auto-round/archive/refs/tags/v0.4.3.tar.gz
|
51 |
+
tar -xvzf v0.4.3.tar.gz
|
52 |
+
cd auto-round-0.4.3
|
53 |
+
pip install -r requirements-cpu.txt --upgrade
|
54 |
+
```
|
55 |
+
|
56 |
+
### Step 2 Build Intel AutoRound wheel from sources
|
57 |
+
|
58 |
+
```
|
59 |
+
pip install -vvv --no-build-isolation -e .[cpu]
|
60 |
+
```
|
61 |
+
|
62 |
+
### Step 3 Script for Quantization
|
63 |
+
|
64 |
+
```
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
model_name = "sapienzanlp/Minerva-3B-base-v1.0"
|
67 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
68 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
69 |
+
from auto_round import AutoRound
|
70 |
+
bits, group_size, sym, device, amp = 4, 128, False, 'cpu', False
|
71 |
+
autoround = AutoRound(model, tokenizer, nsamples=128, iters=200, seqlen=512, batch_size=4, bits=bits, group_size=group_size, sym=sym, device=device, amp=amp)
|
72 |
+
autoround.quantize()
|
73 |
+
output_dir = "./AutoRound/sapienzanlp_Minerva-3B-base-v1.0-autogptq-int4-gs128-asym"
|
74 |
+
autoround.save_quantized(output_dir, format='auto_gptq', inplace=True)
|
75 |
+
```
|
76 |
+
|
77 |
+
## License
|
78 |
+
|
79 |
+
[Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/)
|
80 |
+
|
81 |
+
## Disclaimer
|
82 |
+
|
83 |
+
This quantized model comes with no warranty. It has been developed only for research purposes.
|
84 |
+
|
config.json
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "sapienzanlp/Minerva-3B-base-v1.0",
|
3 |
+
"architectures": [
|
4 |
+
"MistralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"head_dim": 80,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 2560,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 8960,
|
14 |
+
"max_position_embeddings": 16384,
|
15 |
+
"model_type": "mistral",
|
16 |
+
"num_attention_heads": 32,
|
17 |
+
"num_hidden_layers": 32,
|
18 |
+
"num_key_value_heads": 8,
|
19 |
+
"quantization_config": {
|
20 |
+
"amp": false,
|
21 |
+
"autoround_version": "0.4.3",
|
22 |
+
"batch_size": 4,
|
23 |
+
"bits": 4,
|
24 |
+
"damp_percent": 0.01,
|
25 |
+
"data_type": "int",
|
26 |
+
"desc_act": false,
|
27 |
+
"enable_minmax_tuning": true,
|
28 |
+
"enable_norm_bias_tuning": false,
|
29 |
+
"enable_quanted_input": true,
|
30 |
+
"gradient_accumulate_steps": 1,
|
31 |
+
"group_size": 128,
|
32 |
+
"iters": 200,
|
33 |
+
"low_gpu_mem_usage": false,
|
34 |
+
"lr": 0.005,
|
35 |
+
"minmax_lr": 0.005,
|
36 |
+
"nsamples": 128,
|
37 |
+
"quant_method": "gptq",
|
38 |
+
"scale_dtype": "torch.float16",
|
39 |
+
"seqlen": 512,
|
40 |
+
"sym": false,
|
41 |
+
"to_quant_block_names": null,
|
42 |
+
"true_sequential": false
|
43 |
+
},
|
44 |
+
"rms_norm_eps": 1e-05,
|
45 |
+
"rope_theta": 10000.0,
|
46 |
+
"sliding_window": 2048,
|
47 |
+
"tie_word_embeddings": false,
|
48 |
+
"torch_dtype": "float32",
|
49 |
+
"transformers_version": "4.47.1",
|
50 |
+
"use_cache": false,
|
51 |
+
"vocab_size": 32768
|
52 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"transformers_version": "4.47.1",
|
6 |
+
"use_cache": false
|
7 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a5de0fca74980a6045b6c6dea49f20cfd09ebcf01db1b1c500082bbc286dff17
|
3 |
+
size 2091371832
|
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 |
+
"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 |
+
"autoround_version": "0.4.3",
|
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:bb411d9f702041597b9c84f0c99ee6601f02631467e2a76722db3ca1a2a77bf5
|
3 |
+
size 795167
|
tokenizer_config.json
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": true,
|
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 |
+
"extra_special_tokens": {},
|
35 |
+
"legacy": true,
|
36 |
+
"model_max_length": 1000000000000000019884624838656,
|
37 |
+
"pad_token": null,
|
38 |
+
"sp_model_kwargs": {},
|
39 |
+
"spaces_between_special_tokens": false,
|
40 |
+
"tokenizer_class": "LlamaTokenizer",
|
41 |
+
"unk_token": "<unk>",
|
42 |
+
"use_default_system_prompt": true
|
43 |
+
}
|