Upload folder using huggingface_hub

#1
README.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
3
+ base_model: jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B
4
+ metrics:
5
+ - memory_disk
6
+ - memory_inference
7
+ - inference_latency
8
+ - inference_throughput
9
+ - inference_CO2_emissions
10
+ - inference_energy_consumption
11
+ tags:
12
+ - pruna-ai
13
+ ---
14
+ <!-- header start -->
15
+ <!-- 200823 -->
16
+ <div style="width: auto; margin-left: auto; margin-right: auto">
17
+ <a href="https://www.pruna.ai/" target="_blank" rel="noopener noreferrer">
18
+ <img src="https://i.imgur.com/eDAlcgk.png" alt="PrunaAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
19
+ </a>
20
+ </div>
21
+ <!-- header end -->
22
+
23
+ [![Twitter](https://img.shields.io/twitter/follow/PrunaAI?style=social)](https://twitter.com/PrunaAI)
24
+ [![GitHub](https://img.shields.io/github/followers/PrunaAI?label=Follow%20%40PrunaAI&style=social)](https://github.com/PrunaAI)
25
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following)
26
+ [![Discord](https://img.shields.io/badge/Discord-Join%20Us-blue?style=social&logo=discord)](https://discord.gg/rskEr4BZJx)
27
+
28
+ # Simply make AI models cheaper, smaller, faster, and greener!
29
+
30
+ - Give a thumbs up if you like this model!
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
+
38
+ ![image info](./plots.png)
39
+
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.
47
+ - ***How to compress my own models?*** You can request premium access to more compression methods and tech support for your specific use-cases [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
48
+ - ***What are "first" metrics?*** Results mentioning "first" are obtained after the first run of the model. The first run might take more memory or be slower than the subsequent runs due cuda overheads.
49
+ - ***What are "Sync" and "Async" metrics?*** "Sync" metrics are obtained by syncing all GPU processes and stop measurement when all of them are executed. "Async" metrics are obtained without syncing all GPU processes and stop when the model output can be used by the CPU. We provide both metrics since both could be relevant depending on the use-case. We recommend to test the efficiency gains directly in your use-cases.
50
+
51
+ ## Setup
52
+
53
+ You can run the smashed model with these steps:
54
+
55
+ 0. Check requirements from the original repo jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B 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
59
+ ```
60
+ 2. Load & run the model.
61
+ ```python
62
+ from transformers import AutoModelForCausalLM, AutoTokenizer
63
+ from hqq.engine.hf import HQQModelForCausalLM
64
+ from hqq.models.hf.base import AutoHQQHFModel
65
+
66
+ try:
67
+ model = HQQModelForCausalLM.from_quantized("PrunaAI/jiajunlong-TinyLLaVA-OpenELM-450M-CLIP-0.55B-HQQ-2bit-smashed", device_map='auto')
68
+ except:
69
+ model = AutoHQQHFModel.from_quantized("PrunaAI/jiajunlong-TinyLLaVA-OpenELM-450M-CLIP-0.55B-HQQ-2bit-smashed")
70
+ tokenizer = AutoTokenizer.from_pretrained("jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B")
71
+
72
+ input_ids = tokenizer("What is the color of prunes?,", return_tensors='pt').to(model.device)["input_ids"]
73
+
74
+ outputs = model.generate(input_ids, max_new_tokens=216)
75
+ tokenizer.decode(outputs[0])
76
+ ```
77
+
78
+ ## Configurations
79
+
80
+ 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 jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B 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
+
88
+ - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
89
+ - Request access to easily compress your own AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
config.json ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B",
3
+ "architectures": [
4
+ "TinyLlavaForConditionalGeneration"
5
+ ],
6
+ "auto_map": {
7
+ "AutoConfig": "jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B--configuration.TinyLlavaConfig",
8
+ "AutoModelForCausalLM": "jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B--modeling_tinyllava_elm.TinyLlavaForConditionalGeneration"
9
+ },
10
+ "cache_dir": null,
11
+ "connector_type": "mlp2x_gelu",
12
+ "hidden_size": 1536,
13
+ "ignore_index": -100,
14
+ "image_aspect_ratio": "square",
15
+ "image_token_index": -200,
16
+ "llm_model_name_or_path": "apple/OpenELM-450M-Instruct",
17
+ "model_type": "tinyllava",
18
+ "num_queries": 128,
19
+ "num_resampler_layers": 3,
20
+ "pad_token": "<unk>",
21
+ "resampler_hidden_size": 768,
22
+ "text_config": {
23
+ "_name_or_path": "apple/OpenELM-450M-Instruct",
24
+ "activation_fn_name": "swish",
25
+ "architectures": [
26
+ "OpenELMForCausalLM"
27
+ ],
28
+ "auto_map": {
29
+ "AutoConfig": "apple/OpenELM-450M-Instruct--configuration_openelm.OpenELMConfig",
30
+ "AutoModelForCausalLM": "apple/OpenELM-450M-Instruct--modeling_openelm.OpenELMForCausalLM"
31
+ },
32
+ "ffn_dim_divisor": 256,
33
+ "ffn_multipliers": [
34
+ 0.5,
35
+ 0.68,
36
+ 0.87,
37
+ 1.05,
38
+ 1.24,
39
+ 1.42,
40
+ 1.61,
41
+ 1.79,
42
+ 1.97,
43
+ 2.16,
44
+ 2.34,
45
+ 2.53,
46
+ 2.71,
47
+ 2.89,
48
+ 3.08,
49
+ 3.26,
50
+ 3.45,
51
+ 3.63,
52
+ 3.82,
53
+ 4.0
54
+ ],
55
+ "ffn_with_glu": true,
56
+ "head_dim": 64,
57
+ "max_context_length": 2048,
58
+ "model_dim": 1536,
59
+ "model_type": "openelm",
60
+ "normalization_layer_name": "rms_norm",
61
+ "normalize_qk_projections": true,
62
+ "num_gqa_groups": 4,
63
+ "num_kv_heads": [
64
+ 3,
65
+ 3,
66
+ 3,
67
+ 4,
68
+ 4,
69
+ 4,
70
+ 4,
71
+ 4,
72
+ 4,
73
+ 4,
74
+ 5,
75
+ 5,
76
+ 5,
77
+ 5,
78
+ 5,
79
+ 5,
80
+ 6,
81
+ 6,
82
+ 6,
83
+ 6
84
+ ],
85
+ "num_query_heads": [
86
+ 12,
87
+ 12,
88
+ 12,
89
+ 16,
90
+ 16,
91
+ 16,
92
+ 16,
93
+ 16,
94
+ 16,
95
+ 16,
96
+ 20,
97
+ 20,
98
+ 20,
99
+ 20,
100
+ 20,
101
+ 20,
102
+ 24,
103
+ 24,
104
+ 24,
105
+ 24
106
+ ],
107
+ "num_transformer_layers": 20,
108
+ "qkv_multipliers": [
109
+ 0.5,
110
+ 1.0
111
+ ],
112
+ "rope_freq_constant": 10000,
113
+ "rope_max_length": 4096,
114
+ "share_input_output_layers": true,
115
+ "tie_word_embeddings": true,
116
+ "torch_dtype": "float16"
117
+ },
118
+ "tokenizer_model_max_length": 2048,
119
+ "tokenizer_name_or_path": "meta-llama/Llama-2-7b-hf",
120
+ "tokenizer_padding_side": "right",
121
+ "tokenizer_use_fast": false,
122
+ "torch_dtype": "float16",
123
+ "transformers_version": "4.42.4",
124
+ "tune_type_connector": "full",
125
+ "tune_type_llm": "full",
126
+ "tune_type_vision_tower": "frozen",
127
+ "tune_vision_tower_from_layer": 0,
128
+ "use_cache": true,
129
+ "vision_config": {
130
+ "dropout": 0.0,
131
+ "hidden_size": 768,
132
+ "image_size": 224,
133
+ "intermediate_size": 3072,
134
+ "model_name_or_path": "openai/clip-vit-base-patch16",
135
+ "model_name_or_path2": "",
136
+ "model_type": "clip_vision_model",
137
+ "num_attention_heads": 12,
138
+ "num_hidden_layers": 12,
139
+ "patch_size": 16,
140
+ "projection_dim": 512
141
+ },
142
+ "vision_feature_layer": -2,
143
+ "vision_feature_select_strategy": "patch",
144
+ "vision_hidden_size": 768,
145
+ "vision_model_name_or_path": "openai/clip-vit-base-patch16",
146
+ "vision_model_name_or_path2": "",
147
+ "vocab_size": 32000
148
+ }
qmodel.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef0ec1698624c5befd69079d6e6ac5aac7111f388b39dce1a10e85ba41ba2452
3
+ size 236225842
smash_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": 2,
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/modelsqkl6j5y0",
18
+ "batch_size": 1,
19
+ "model_name": "jiajunlong/TinyLLaVA-OpenELM-450M-CLIP-0.55B",
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
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "pad_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
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.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
3
+ size 499723
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
+ "legacy": false,
35
+ "model_max_length": 2048,
36
+ "pad_token": "<unk>",
37
+ "padding_side": "right",
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
+ }