johannaSommer
commited on
Commit
•
d912e9c
1
Parent(s):
834a187
859d027c147c53cb050030643356f248003ccd101bbf3e8a28061336b17082c3
Browse files- README.md +9 -8
- config.json +5 -2
- generation_config.json +1 -1
- merges.txt +0 -0
- model.safetensors +2 -2
- smash_config.json +17 -6
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer_config.json +31 -0
- vocab.json +0 -0
README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
---
|
2 |
thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
|
|
|
3 |
metrics:
|
4 |
- memory_disk
|
5 |
- memory_inference
|
@@ -30,7 +31,7 @@ tags:
|
|
30 |
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
31 |
- Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
32 |
- Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
|
33 |
-
- Join Pruna AI community on Discord [here](https://discord.gg/
|
34 |
|
35 |
## Results
|
36 |
|
@@ -39,7 +40,7 @@ tags:
|
|
39 |
**Frequently Asked Questions**
|
40 |
- ***How does the compression work?*** The model is compressed with llm-int8.
|
41 |
- ***How does the model quality change?*** The quality of the model output might vary compared to the base model.
|
42 |
-
- ***How is the model efficiency evaluated?*** These results were obtained on
|
43 |
- ***What is the model format?*** We use safetensors.
|
44 |
- ***What calibration data has been used?*** If needed by the compression method, we used WikiText as the calibration data.
|
45 |
- ***What is the naming convention for Pruna Huggingface models?*** We take the original model name and append "turbo", "tiny", or "green" if the smashed model has a measured inference speed, inference memory, or inference energy consumption which is less than 90% of the original base model.
|
@@ -59,15 +60,15 @@ You can run the smashed model with these steps:
|
|
59 |
2. Load & run the model.
|
60 |
```python
|
61 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
tokenizer = AutoTokenizer.from_pretrained("facebook/opt-125m")
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
```
|
72 |
|
73 |
## Configurations
|
|
|
1 |
---
|
2 |
thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
|
3 |
+
base_model: facebook/opt-125m
|
4 |
metrics:
|
5 |
- memory_disk
|
6 |
- memory_inference
|
|
|
31 |
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
32 |
- Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
33 |
- Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
|
34 |
+
- Join Pruna AI community on Discord [here](https://discord.gg/CP4VSgck) to share feedback/suggestions or get help.
|
35 |
|
36 |
## Results
|
37 |
|
|
|
40 |
**Frequently Asked Questions**
|
41 |
- ***How does the compression work?*** The model is compressed with llm-int8.
|
42 |
- ***How does the model quality change?*** The quality of the model output might vary compared to the base model.
|
43 |
+
- ***How is the model efficiency evaluated?*** These results were obtained on HARDWARE_NAME with configuration described in `model/smash_config.json` and are obtained after a hardware warmup. The smashed model is directly compared to the original base model. Efficiency results may vary in other settings (e.g. other hardware, image size, batch size, ...). We recommend to directly run them in the use-case conditions to know if the smashed model can benefit you.
|
44 |
- ***What is the model format?*** We use safetensors.
|
45 |
- ***What calibration data has been used?*** If needed by the compression method, we used WikiText as the calibration data.
|
46 |
- ***What is the naming convention for Pruna Huggingface models?*** We take the original model name and append "turbo", "tiny", or "green" if the smashed model has a measured inference speed, inference memory, or inference energy consumption which is less than 90% of the original base model.
|
|
|
60 |
2. Load & run the model.
|
61 |
```python
|
62 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
63 |
+
|
64 |
|
65 |
+
model = AutoModelForCausalLM.from_pretrained("PrunaAI/facebook-opt-125m-bnb-8bit-smashed", trust_remote_code=True, device_map='auto')
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained("facebook/opt-125m")
|
|
|
67 |
|
68 |
+
input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
|
69 |
|
70 |
+
outputs = model.generate(input_ids, max_new_tokens=216)
|
71 |
+
tokenizer.decode(outputs[0])
|
72 |
```
|
73 |
|
74 |
## Configurations
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "/
|
3 |
"_remove_final_layer_norm": false,
|
4 |
"activation_dropout": 0.0,
|
5 |
"activation_function": "relu",
|
@@ -24,7 +24,10 @@
|
|
24 |
"pad_token_id": 1,
|
25 |
"prefix": "</s>",
|
26 |
"quantization_config": {
|
|
|
|
|
27 |
"bnb_4bit_compute_dtype": "bfloat16",
|
|
|
28 |
"bnb_4bit_quant_type": "fp4",
|
29 |
"bnb_4bit_use_double_quant": false,
|
30 |
"llm_int8_enable_fp32_cpu_offload": false,
|
@@ -38,7 +41,7 @@
|
|
38 |
"quant_method": "bitsandbytes"
|
39 |
},
|
40 |
"torch_dtype": "float16",
|
41 |
-
"transformers_version": "4.
|
42 |
"use_cache": true,
|
43 |
"vocab_size": 50272,
|
44 |
"word_embed_proj_dim": 768
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "/efs/sommer/cache/wdzixvjngwsxmo90",
|
3 |
"_remove_final_layer_norm": false,
|
4 |
"activation_dropout": 0.0,
|
5 |
"activation_function": "relu",
|
|
|
24 |
"pad_token_id": 1,
|
25 |
"prefix": "</s>",
|
26 |
"quantization_config": {
|
27 |
+
"_load_in_4bit": false,
|
28 |
+
"_load_in_8bit": true,
|
29 |
"bnb_4bit_compute_dtype": "bfloat16",
|
30 |
+
"bnb_4bit_quant_storage": "uint8",
|
31 |
"bnb_4bit_quant_type": "fp4",
|
32 |
"bnb_4bit_use_double_quant": false,
|
33 |
"llm_int8_enable_fp32_cpu_offload": false,
|
|
|
41 |
"quant_method": "bitsandbytes"
|
42 |
},
|
43 |
"torch_dtype": "float16",
|
44 |
+
"transformers_version": "4.44.2",
|
45 |
"use_cache": true,
|
46 |
"vocab_size": 50272,
|
47 |
"word_embed_proj_dim": 768
|
generation_config.json
CHANGED
@@ -3,5 +3,5 @@
|
|
3 |
"bos_token_id": 2,
|
4 |
"eos_token_id": 2,
|
5 |
"pad_token_id": 1,
|
6 |
-
"transformers_version": "4.
|
7 |
}
|
|
|
3 |
"bos_token_id": 2,
|
4 |
"eos_token_id": 2,
|
5 |
"pad_token_id": 1,
|
6 |
+
"transformers_version": "4.44.2"
|
7 |
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1a094a9afa29b8d44e9362c18d980db67fbcf80061c194d6ae598c298e68e685
|
3 |
+
size 165913552
|
smash_config.json
CHANGED
@@ -8,14 +8,25 @@
|
|
8 |
"compilers": "None",
|
9 |
"task": "text_text_generation",
|
10 |
"device": "cuda",
|
11 |
-
"cache_dir": "/
|
12 |
"batch_size": 1,
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
"pruning_ratio": 0.0,
|
17 |
-
"
|
18 |
-
"
|
|
|
|
|
19 |
"max_batch_size": 1,
|
20 |
"qtype_weight": "torch.qint8",
|
21 |
"qtype_activation": "torch.quint8",
|
|
|
8 |
"compilers": "None",
|
9 |
"task": "text_text_generation",
|
10 |
"device": "cuda",
|
11 |
+
"cache_dir": "/efs/sommer/cache/wdzixvjn",
|
12 |
"batch_size": 1,
|
13 |
+
"tokenizer_name": "GPT2TokenizerFast(name_or_path='facebook/opt-125m', vocab_size=50265, model_max_length=1000000000000000019884624838656, is_fast=True, padding_side='right', truncation_side='right', special_tokens={'bos_token': '</s>', 'eos_token': '</s>', 'unk_token': '</s>', 'pad_token': '<pad>'}, clean_up_tokenization_spaces=True), added_tokens_decoder={\n\t1: AddedToken(\"<pad>\", rstrip=False, lstrip=False, single_word=False, normalized=True, special=True),\n\t2: AddedToken(\"</s>\", rstrip=False, lstrip=False, single_word=False, normalized=True, special=True),\n}",
|
14 |
+
"pruning_type": "structured-taylor",
|
15 |
+
"sparsity_level": 0.5,
|
16 |
+
"head_pruning_ratio": 0.5,
|
17 |
+
"iterative_steps": 1,
|
18 |
+
"sequence_length": 2048,
|
19 |
+
"calibration_data_size": 10,
|
20 |
+
"global_pruning": false,
|
21 |
+
"ignore_embeddings": false,
|
22 |
+
"prune_head_dims": false,
|
23 |
+
"prune_num_heads": true,
|
24 |
+
"ignored_layers": "[0, 1, 10, 11]",
|
25 |
"pruning_ratio": 0.0,
|
26 |
+
"model_configs": "{'return_dict': True, 'output_hidden_states': False, 'output_attentions': False, 'torchscript': False, 'torch_dtype': 'float16', 'use_bfloat16': False, 'tf_legacy_loss': False, 'pruned_heads': {}, 'tie_word_embeddings': True, 'chunk_size_feed_forward': 0, 'is_encoder_decoder': False, 'is_decoder': False, 'cross_attention_hidden_size': None, 'add_cross_attention': False, 'tie_encoder_decoder': False, 'max_length': 20, 'min_length': 0, 'do_sample': False, 'early_stopping': False, 'num_beams': 1, 'num_beam_groups': 1, 'diversity_penalty': 0.0, 'temperature': 1.0, 'top_k': 50, 'top_p': 1.0, 'typical_p': 1.0, 'repetition_penalty': 1.0, 'length_penalty': 1.0, 'no_repeat_ngram_size': 0, 'encoder_no_repeat_ngram_size': 0, 'bad_words_ids': None, 'num_return_sequences': 1, 'output_scores': False, 'return_dict_in_generate': False, 'forced_bos_token_id': None, 'forced_eos_token_id': None, 'remove_invalid_values': False, 'exponential_decay_length_penalty': None, 'suppress_tokens': None, 'begin_suppress_tokens': None, 'architectures': ['OPTForCausalLM'], 'finetuning_task': None, 'id2label': {0: 'LABEL_0', 1: 'LABEL_1'}, 'label2id': {'LABEL_0': 0, 'LABEL_1': 1}, 'tokenizer_class': None, 'prefix': '</s>', 'bos_token_id': 2, 'pad_token_id': 1, 'eos_token_id': 2, 'sep_token_id': None, 'decoder_start_token_id': None, 'task_specific_params': None, 'problem_type': None, '_name_or_path': 'facebook/opt-125m', 'transformers_version': '4.44.2', 'activation_dropout': 0.0, 'model_type': 'opt', 'vocab_size': 50272, 'max_position_embeddings': 2048, 'num_attention_heads': 12, 'word_embed_proj_dim': 768, 'ffn_dim': 3072, 'hidden_size': 768, 'num_hidden_layers': 12, 'dropout': 0.1, 'attention_dropout': 0.0, 'activation_function': 'relu', 'init_std': 0.02, 'layerdrop': 0.0, 'use_cache': True, 'do_layer_norm_before': True, 'enable_bias': True, 'layer_norm_elementwise_affine': True, '_remove_final_layer_norm': False}",
|
27 |
+
"model_name": "facebook/opt-125m",
|
28 |
+
"weight_quantization_bits": 8,
|
29 |
+
"output_deviation": 0.0,
|
30 |
"max_batch_size": 1,
|
31 |
"qtype_weight": "torch.qint8",
|
32 |
"qtype_activation": "torch.quint8",
|
special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"pad_token": {
|
17 |
+
"content": "<pad>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"unk_token": {
|
24 |
+
"content": "</s>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": true,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
}
|
30 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"1": {
|
6 |
+
"content": "<pad>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"2": {
|
14 |
+
"content": "</s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": true,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
}
|
21 |
+
},
|
22 |
+
"bos_token": "</s>",
|
23 |
+
"clean_up_tokenization_spaces": true,
|
24 |
+
"eos_token": "</s>",
|
25 |
+
"errors": "replace",
|
26 |
+
"legacy": false,
|
27 |
+
"model_max_length": 1000000000000000019884624838656,
|
28 |
+
"pad_token": "<pad>",
|
29 |
+
"tokenizer_class": "GPT2Tokenizer",
|
30 |
+
"unk_token": "</s>"
|
31 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|