Initial Upload
Browse files- README.md +85 -0
- config.json +55 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- quantization_config.json +24 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +43 -0
README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- pytorch
|
| 4 |
+
- causal-lm
|
| 5 |
+
- OpenLLaMA
|
| 6 |
+
- autoround
|
| 7 |
+
- auto-round
|
| 8 |
+
- intel-autoround
|
| 9 |
+
- gptq
|
| 10 |
+
- woq
|
| 11 |
+
- intel
|
| 12 |
+
- pytorch
|
| 13 |
+
- openlm-research
|
| 14 |
+
license: apache-2.0
|
| 15 |
+
datasets:
|
| 16 |
+
- tiiuae/falcon-refinedweb
|
| 17 |
+
- bigcode/starcoderdata
|
| 18 |
+
- togethercomputer/RedPajama-Data-1T
|
| 19 |
+
model_name: OpenLLaMA 7B v2
|
| 20 |
+
base_model:
|
| 21 |
+
- openlm-research/open_llama_7b_v2
|
| 22 |
+
inference: false
|
| 23 |
+
model_creator: openlm-research
|
| 24 |
+
pipeline_tag: text-generation
|
| 25 |
+
prompt_template: '{prompt}
|
| 26 |
+
'
|
| 27 |
+
quantized_by: fbaldassarri
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Model Information
|
| 31 |
+
|
| 32 |
+
Quantized version of [openlm-research/open_llama_7b_v2](https://huggingface.co/openlm-research/open_llama_7b_v2) using torch.float32 for quantization tuning.
|
| 33 |
+
- 4 bits (INT4)
|
| 34 |
+
- group size = 64
|
| 35 |
+
- Asymmetrical Quantization
|
| 36 |
+
- Method WoQ (AutoRound format)
|
| 37 |
+
|
| 38 |
+
Fast and low memory, 2-3X speedup (slight accuracy drop at W4G64)
|
| 39 |
+
|
| 40 |
+
Quantization framework: [Intel AutoRound](https://github.com/intel/auto-round) v0.4.6
|
| 41 |
+
|
| 42 |
+
Note: this INT4 version of open_llama_7b_v2 has been quantized to run inference through CPU.
|
| 43 |
+
|
| 44 |
+
## Replication Recipe
|
| 45 |
+
|
| 46 |
+
### Step 1 Install Requirements
|
| 47 |
+
|
| 48 |
+
I suggest to install requirements into a dedicated python-virtualenv or a conda enviroment.
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
wget https://github.com/intel/auto-round/archive/refs/tags/v0.4.6.tar.gz
|
| 52 |
+
tar -xvzf v0.4.6.tar.gz
|
| 53 |
+
cd auto-round-0.4.6
|
| 54 |
+
pip install -r requirements-cpu.txt --upgrade
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### Step 2 Build Intel AutoRound wheel from sources
|
| 58 |
+
|
| 59 |
+
```
|
| 60 |
+
pip install -vvv --no-build-isolation -e .[cpu]
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Step 3 Script for Quantization
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 67 |
+
model_name = "openlm-research/open_llama_7b_v2"
|
| 68 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 69 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 70 |
+
from auto_round import AutoRound
|
| 71 |
+
bits, group_size, sym, device, amp = 4, 64, False, 'cpu', False
|
| 72 |
+
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)
|
| 73 |
+
autoround.quantize()
|
| 74 |
+
output_dir = "./AutoRound/openlm-research_open_llama_7b_v2-autoround-int4-gs64-asym"
|
| 75 |
+
autoround.save_quantized(output_dir, format='auto_round', inplace=True)
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
|
| 80 |
+
[Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/)
|
| 81 |
+
|
| 82 |
+
## Disclaimer
|
| 83 |
+
|
| 84 |
+
This quantized model comes with no warranty. It has been developed only for research purposes.
|
| 85 |
+
|
config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "openlm-research/open_llama_7b_v2",
|
| 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": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 4096,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 11008,
|
| 15 |
+
"max_position_embeddings": 2048,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 32,
|
| 19 |
+
"num_hidden_layers": 32,
|
| 20 |
+
"num_key_value_heads": 32,
|
| 21 |
+
"pad_token_id": 0,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"quantization_config": {
|
| 24 |
+
"amp": false,
|
| 25 |
+
"autoround_version": "0.4.6",
|
| 26 |
+
"backend": "auto_round:exllamav2",
|
| 27 |
+
"batch_size": 4,
|
| 28 |
+
"bits": 4,
|
| 29 |
+
"data_type": "int",
|
| 30 |
+
"dataset": "NeelNanda/pile-10k",
|
| 31 |
+
"enable_minmax_tuning": true,
|
| 32 |
+
"enable_norm_bias_tuning": false,
|
| 33 |
+
"enable_quanted_input": true,
|
| 34 |
+
"gradient_accumulate_steps": 1,
|
| 35 |
+
"group_size": 64,
|
| 36 |
+
"iters": 200,
|
| 37 |
+
"low_gpu_mem_usage": false,
|
| 38 |
+
"lr": 0.005,
|
| 39 |
+
"minmax_lr": 0.005,
|
| 40 |
+
"nsamples": 128,
|
| 41 |
+
"quant_method": "intel/auto-round",
|
| 42 |
+
"scale_dtype": "torch.float16",
|
| 43 |
+
"seqlen": 512,
|
| 44 |
+
"sym": false,
|
| 45 |
+
"to_quant_block_names": null
|
| 46 |
+
},
|
| 47 |
+
"rms_norm_eps": 1e-06,
|
| 48 |
+
"rope_scaling": null,
|
| 49 |
+
"rope_theta": 10000.0,
|
| 50 |
+
"tie_word_embeddings": false,
|
| 51 |
+
"torch_dtype": "float16",
|
| 52 |
+
"transformers_version": "4.49.0",
|
| 53 |
+
"use_cache": true,
|
| 54 |
+
"vocab_size": 32000
|
| 55 |
+
}
|
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 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.49.0"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bb38a3d8192501ab000b650fbb97b0ab3e0a4d3ae0641f983ffdf47ff36e0ad4
|
| 3 |
+
size 4545276048
|
quantization_config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"dataset": "NeelNanda/pile-10k",
|
| 21 |
+
"autoround_version": "0.4.6",
|
| 22 |
+
"quant_method": "intel/auto-round",
|
| 23 |
+
"backend": "auto_round:exllamav2"
|
| 24 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": true,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": true,
|
| 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:91b289e85fa20fd375d8b33dc12f77616f18abc6359804471d1fafcb425fecb8
|
| 3 |
+
size 511574
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": true,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": true,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": true,
|
| 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": 2048,
|
| 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": false
|
| 43 |
+
}
|