Upload folder using huggingface_hub

#3
by sharpenb - opened
Files changed (5) hide show
  1. README.md +11 -10
  2. config.json +6 -3
  3. generation_config.json +1 -1
  4. model.safetensors +2 -2
  5. smash_config.json +21 -25
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/rskEr4BZJx) to share feedback/suggestions or get help.
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 NVIDIA A100-PCIE-40GB 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.
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.
@@ -51,7 +52,7 @@ tags:
51
 
52
  You can run the smashed model with these steps:
53
 
54
- 0. Check requirements from the original repo openai-community/gpt2 installed. In particular, check python, cuda, and transformers versions.
55
  1. Make sure that you have installed quantization related packages.
56
  ```bash
57
  pip install transformers accelerate bitsandbytes>0.37.0
@@ -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
- model = AutoModelForCausalLM.from_pretrained("PrunaAI/openai-community-gpt2-bnb-8bit-smashed",
64
- trust_remote_code=True, device_map='auto')
65
- tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
66
 
67
- input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
68
 
69
- outputs = model.generate(input_ids, max_new_tokens=216)
70
- tokenizer.decode(outputs[0])
71
  ```
72
 
73
  ## Configurations
@@ -76,7 +77,7 @@ The configuration info are in `smash_config.json`.
76
 
77
  ## Credits & License
78
 
79
- The license of the smashed model follows the license of the original model. Please check the license of the original model openai-community/gpt2 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.
80
 
81
  ## Want to compress other models?
82
 
 
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 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 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 transformers accelerate bitsandbytes>0.37.0
 
60
  2. Load & run the model.
61
  ```python
62
  from transformers import AutoModelForCausalLM, AutoTokenizer
63
+
64
 
65
+ model = AutoModelForCausalLM.from_pretrained("PrunaAI/openai-community-gpt2-bnb-8bit-smashed", trust_remote_code=True, device_map='auto')
66
+ tokenizer = AutoTokenizer.from_pretrained("ORIGINAL_REPO_NAME")
 
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
 
77
 
78
  ## Credits & License
79
 
80
+ 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.
81
 
82
  ## Want to compress other models?
83
 
config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "_name_or_path": "/tmp/tmp5o12a7ow",
3
  "activation_function": "gelu_new",
4
  "architectures": [
5
  "GPT2LMHeadModel"
@@ -18,7 +18,10 @@
18
  "n_layer": 12,
19
  "n_positions": 1024,
20
  "quantization_config": {
 
 
21
  "bnb_4bit_compute_dtype": "bfloat16",
 
22
  "bnb_4bit_quant_type": "fp4",
23
  "bnb_4bit_use_double_quant": false,
24
  "llm_int8_enable_fp32_cpu_offload": false,
@@ -46,8 +49,8 @@
46
  "max_length": 50
47
  }
48
  },
49
- "torch_dtype": "float16",
50
- "transformers_version": "4.37.1",
51
  "use_cache": true,
52
  "vocab_size": 50257
53
  }
 
1
  {
2
+ "_name_or_path": "/tmp/models/tmppjwhiohq5d0ibc63",
3
  "activation_function": "gelu_new",
4
  "architectures": [
5
  "GPT2LMHeadModel"
 
18
  "n_layer": 12,
19
  "n_positions": 1024,
20
  "quantization_config": {
21
+ "_load_in_4bit": false,
22
+ "_load_in_8bit": true,
23
  "bnb_4bit_compute_dtype": "bfloat16",
24
+ "bnb_4bit_quant_storage": "uint8",
25
  "bnb_4bit_quant_type": "fp4",
26
  "bnb_4bit_use_double_quant": false,
27
  "llm_int8_enable_fp32_cpu_offload": false,
 
49
  "max_length": 50
50
  }
51
  },
52
+ "torch_dtype": "bfloat16",
53
+ "transformers_version": "4.48.2",
54
  "use_cache": true,
55
  "vocab_size": 50257
56
  }
generation_config.json CHANGED
@@ -2,5 +2,5 @@
2
  "_from_model_config": true,
3
  "bos_token_id": 50256,
4
  "eos_token_id": 50256,
5
- "transformers_version": "4.37.1"
6
  }
 
2
  "_from_model_config": true,
3
  "bos_token_id": 50256,
4
  "eos_token_id": 50256,
5
+ "transformers_version": "4.48.2"
6
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a04c57051e14d009a75911b944fdd80cd862b3cbd5d3eeb13bdcd2cb4028cb0a
3
- size 164295680
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1821097c22177a471337bf0c8796d51bc4a879373c6b53e62b03cc34d31ef1eb
3
+ size 164300920
smash_config.json CHANGED
@@ -1,27 +1,23 @@
1
  {
2
- "api_key": null,
3
- "verify_url": "http://johnrachwan.pythonanywhere.com",
4
- "smash_config": {
5
- "pruners": "None",
6
- "factorizers": "None",
7
- "quantizers": "['llm-int8']",
8
- "compilers": "None",
9
- "task": "text_text_generation",
10
- "device": "cuda",
11
- "cache_dir": "/ceph/hdd/staff/charpent/.cache/modelsk3czjl20",
12
- "batch_size": 1,
13
- "model_name": "openai-community/gpt2",
14
- "pruning_ratio": 0.0,
15
- "n_quantization_bits": 8,
16
- "output_deviation": 0.005,
17
- "max_batch_size": 1,
18
- "qtype_weight": "torch.qint8",
19
- "qtype_activation": "torch.quint8",
20
- "qobserver": "<class 'torch.ao.quantization.observer.MinMaxObserver'>",
21
- "qscheme": "torch.per_tensor_symmetric",
22
- "qconfig": "x86",
23
- "group_size": 128,
24
- "damp_percent": 0.1,
25
- "save_load_fn": "bitsandbytes"
26
- }
27
  }
 
1
  {
2
+ "batchers": null,
3
+ "cachers": null,
4
+ "compilers": null,
5
+ "distillers": null,
6
+ "pruners": null,
7
+ "quantizers": "llm-int8",
8
+ "recoverers": null,
9
+ "quant_llm-int8_compute_dtype": "bfloat16",
10
+ "quant_llm-int8_double_quant": false,
11
+ "quant_llm-int8_enable_fp32_cpu_offload": false,
12
+ "quant_llm-int8_has_fp16_weight": false,
13
+ "quant_llm-int8_quant_type": "fp4",
14
+ "quant_llm-int8_threshold": 6.0,
15
+ "quant_llm-int8_weight_bits": 8,
16
+ "max_batch_size": 1,
17
+ "device": "cuda",
18
+ "cache_dir": "/tmp/models/tmppjwhiohq",
19
+ "task": "",
20
+ "save_load_fn": "llm-int8",
21
+ "save_load_fn_args": {},
22
+ "api_key": null
 
 
 
 
23
  }