sharpenb commited on
Commit
ec0559d
·
verified ·
1 Parent(s): ad3408f

44e86ea118b941efeaa76253cd384294cfb6fd9a2d776e510248a3e689800785

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. config.json +25 -2
  3. smash_config.json +17 -29
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
3
- base_model: meta-llama/Llama-2-7b-chat-hf
4
  metrics:
5
  - memory_disk
6
  - memory_inference
@@ -31,7 +31,7 @@ tags:
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/rskEr4BZJx) to share feedback/suggestions or get help.
35
 
36
  ## Results
37
 
@@ -40,7 +40,7 @@ tags:
40
  **Frequently Asked Questions**
41
  - ***How does the compression work?*** The model is compressed with hqq.
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.
@@ -52,7 +52,7 @@ tags:
52
 
53
  You can run the smashed model with these steps:
54
 
55
- 0. Check requirements from the original repo meta-llama/Llama-2-7b-chat-hf installed. In particular, check python, cuda, and transformers versions.
56
  1. Make sure that you have installed quantization related packages.
57
  ```bash
58
  pip install hqq
@@ -67,7 +67,7 @@ You can run the smashed model with these steps:
67
  model = HQQModelForCausalLM.from_quantized("PrunaAI/meta-llama-Llama-2-7b-chat-hf-HQQ-4bit-smashed", device_map='auto')
68
  except:
69
  model = AutoHQQHFModel.from_quantized("PrunaAI/meta-llama-Llama-2-7b-chat-hf-HQQ-4bit-smashed")
70
- tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
71
 
72
  input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
73
 
@@ -81,7 +81,7 @@ The configuration info are in `smash_config.json`.
81
 
82
  ## Credits & License
83
 
84
- The license of the smashed model follows the license of the original model. Please check the license of the original model meta-llama/Llama-2-7b-chat-hf before using this model which provided the base model. The license of the `pruna-engine` is [here](https://pypi.org/project/pruna-engine/) on Pypi.
85
 
86
  ## Want to compress other models?
87
 
 
1
  ---
2
  thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
3
+ base_model: ORIGINAL_REPO_NAME
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 hqq.
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 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.
 
52
 
53
  You can run the smashed model with these steps:
54
 
55
+ 0. Check requirements from the original repo ORIGINAL_REPO_NAME installed. In particular, check python, cuda, and transformers versions.
56
  1. Make sure that you have installed quantization related packages.
57
  ```bash
58
  pip install hqq
 
67
  model = HQQModelForCausalLM.from_quantized("PrunaAI/meta-llama-Llama-2-7b-chat-hf-HQQ-4bit-smashed", device_map='auto')
68
  except:
69
  model = AutoHQQHFModel.from_quantized("PrunaAI/meta-llama-Llama-2-7b-chat-hf-HQQ-4bit-smashed")
70
+ tokenizer = AutoTokenizer.from_pretrained("ORIGINAL_REPO_NAME")
71
 
72
  input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
73
 
 
81
 
82
  ## Credits & License
83
 
84
+ The license of the smashed model follows the license of the original model. Please check the license of the original model ORIGINAL_REPO_NAME before using this model which provided the base model. The license of the `pruna-engine` is [here](https://pypi.org/project/pruna-engine/) on Pypi.
85
 
86
  ## Want to compress other models?
87
 
config.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
- "_name_or_path": "/tmp/tmpdd7dvklh",
 
3
  "architectures": [
4
  "LlamaForCausalLM"
5
  ],
@@ -7,22 +8,44 @@
7
  "attention_dropout": 0.0,
8
  "bos_token_id": 1,
9
  "eos_token_id": 2,
 
10
  "hidden_act": "silu",
11
  "hidden_size": 4096,
12
  "initializer_range": 0.02,
13
  "intermediate_size": 11008,
14
  "max_position_embeddings": 4096,
 
15
  "model_type": "llama",
16
  "num_attention_heads": 32,
17
  "num_hidden_layers": 32,
18
  "num_key_value_heads": 32,
19
  "pretraining_tp": 1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  "rms_norm_eps": 1e-05,
21
  "rope_scaling": null,
22
  "rope_theta": 10000.0,
23
  "tie_word_embeddings": false,
24
  "torch_dtype": "float16",
25
- "transformers_version": "4.40.0",
26
  "use_cache": true,
27
  "vocab_size": 32000
28
  }
 
1
  {
2
+ "_attn_implementation_autoset": true,
3
+ "_name_or_path": "/tmp/models/tmpvxckwoi0/tmpxjvje_dl",
4
  "architectures": [
5
  "LlamaForCausalLM"
6
  ],
 
8
  "attention_dropout": 0.0,
9
  "bos_token_id": 1,
10
  "eos_token_id": 2,
11
+ "head_dim": 128,
12
  "hidden_act": "silu",
13
  "hidden_size": 4096,
14
  "initializer_range": 0.02,
15
  "intermediate_size": 11008,
16
  "max_position_embeddings": 4096,
17
+ "mlp_bias": false,
18
  "model_type": "llama",
19
  "num_attention_heads": 32,
20
  "num_hidden_layers": 32,
21
  "num_key_value_heads": 32,
22
  "pretraining_tp": 1,
23
+ "quantization_config": {
24
+ "quant_config": {
25
+ "offload_meta": false,
26
+ "scale_quant_params": null,
27
+ "weight_quant_params": {
28
+ "axis": 1,
29
+ "channel_wise": true,
30
+ "group_size": 64,
31
+ "nbits": 4,
32
+ "optimize": true,
33
+ "round_zero": true,
34
+ "view_as_float": false
35
+ },
36
+ "zero_quant_params": null
37
+ },
38
+ "quant_method": "hqq",
39
+ "skip_modules": [
40
+ "lm_head"
41
+ ]
42
+ },
43
  "rms_norm_eps": 1e-05,
44
  "rope_scaling": null,
45
  "rope_theta": 10000.0,
46
  "tie_word_embeddings": false,
47
  "torch_dtype": "float16",
48
+ "transformers_version": "4.48.2",
49
  "use_cache": true,
50
  "vocab_size": 32000
51
  }
smash_config.json CHANGED
@@ -1,31 +1,19 @@
1
  {
2
- "api_key": null,
3
- "verify_url": "http://johnrachwan.pythonanywhere.com",
4
- "smash_config": {
5
- "pruners": "None",
6
- "pruning_ratio": 0.0,
7
- "factorizers": "None",
8
- "quantizers": "['hqq']",
9
- "weight_quantization_bits": 4,
10
- "output_deviation": 0.005,
11
- "compilers": "None",
12
- "static_batch": true,
13
- "static_shape": true,
14
- "controlnet": "None",
15
- "unet_dim": 4,
16
- "device": "cuda",
17
- "cache_dir": "/ceph/hdd/staff/charpent/.cache/models7bc3ewib",
18
- "batch_size": 1,
19
- "model_name": "meta-llama/Llama-2-7b-chat-hf",
20
- "task": "text_text_generation",
21
- "max_batch_size": 1,
22
- "qtype_weight": "torch.qint8",
23
- "qtype_activation": "torch.quint8",
24
- "qobserver": "<class 'torch.ao.quantization.observer.MinMaxObserver'>",
25
- "qscheme": "torch.per_tensor_symmetric",
26
- "qconfig": "x86",
27
- "group_size": 128,
28
- "damp_percent": 0.1,
29
- "save_load_fn": "hqq"
30
- }
31
  }
 
1
  {
2
+ "batchers": null,
3
+ "cachers": null,
4
+ "compilers": null,
5
+ "distillers": null,
6
+ "pruners": null,
7
+ "quantizers": "hqq",
8
+ "recoverers": null,
9
+ "quant_hqq_backend": "torchao_int4",
10
+ "quant_hqq_group_size": 64,
11
+ "quant_hqq_weight_bits": 4,
12
+ "max_batch_size": 1,
13
+ "device": "cuda",
14
+ "cache_dir": "/tmp/models/tmpvxckwoi0",
15
+ "task": "",
16
+ "save_load_fn": "hqq",
17
+ "save_load_fn_args": {},
18
+ "api_key": null
 
 
 
 
 
 
 
 
 
 
 
 
19
  }