Azaz666 commited on
Commit
b38d4c8
·
verified ·
1 Parent(s): 52d9ba7

Layer-pruned Qwen2.5-VL-7B-Instruct (PPL-based (Shortened LLaMA), removed 8 layers, 22.5% reduction)

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
2
+ You are a helpful assistant.<|im_end|>
3
+ {% endif %}<|im_start|>{{ message['role'] }}
4
+ {% if message['content'] is string %}{{ message['content'] }}<|im_end|>
5
+ {% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
6
+ {% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
7
+ {% endif %}
config.json ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2_5_VLForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 151655,
7
+ "model_type": "qwen2_5_vl",
8
+ "text_config": {
9
+ "attention_dropout": 0.0,
10
+ "bos_token_id": 151643,
11
+ "dtype": "bfloat16",
12
+ "eos_token_id": 151645,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 3584,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 18944,
17
+ "layer_types": [
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention"
46
+ ],
47
+ "max_position_embeddings": 128000,
48
+ "max_window_layers": 28,
49
+ "model_type": "qwen2_5_vl_text",
50
+ "num_attention_heads": 28,
51
+ "num_hidden_layers": 20,
52
+ "num_key_value_heads": 4,
53
+ "pad_token_id": null,
54
+ "rms_norm_eps": 1e-06,
55
+ "rope_parameters": {
56
+ "mrope_section": [
57
+ 16,
58
+ 24,
59
+ 24
60
+ ],
61
+ "rope_theta": 1000000.0,
62
+ "rope_type": "default",
63
+ "type": "mrope"
64
+ },
65
+ "sliding_window": null,
66
+ "use_cache": true,
67
+ "use_sliding_window": false,
68
+ "vocab_size": 152064
69
+ },
70
+ "tie_word_embeddings": false,
71
+ "transformers_version": "5.3.0",
72
+ "video_token_id": 151656,
73
+ "vision_config": {
74
+ "depth": 32,
75
+ "dtype": "bfloat16",
76
+ "fullatt_block_indexes": [
77
+ 7,
78
+ 15,
79
+ 23,
80
+ 31
81
+ ],
82
+ "hidden_act": "silu",
83
+ "hidden_size": 1280,
84
+ "in_channels": 3,
85
+ "in_chans": 3,
86
+ "initializer_range": 0.02,
87
+ "intermediate_size": 3420,
88
+ "model_type": "qwen2_5_vl",
89
+ "num_heads": 16,
90
+ "out_hidden_size": 3584,
91
+ "patch_size": 14,
92
+ "spatial_merge_size": 2,
93
+ "spatial_patch_size": 14,
94
+ "temporal_patch_size": 2,
95
+ "tokens_per_second": 2,
96
+ "window_size": 112
97
+ },
98
+ "vision_end_token_id": 151653,
99
+ "vision_start_token_id": 151652,
100
+ "vision_token_id": 151654
101
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b7de9ad0f27b9d01d9554c7c0b8262499c5b9add08e7387b64772de26e27c0a
3
+ size 12855485640
processor_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "do_convert_rgb": true,
5
+ "do_normalize": true,
6
+ "do_rescale": true,
7
+ "do_resize": true,
8
+ "image_mean": [
9
+ 0.48145466,
10
+ 0.4578275,
11
+ 0.40821073
12
+ ],
13
+ "image_processor_type": "Qwen2VLImageProcessorFast",
14
+ "image_std": [
15
+ 0.26862954,
16
+ 0.26130258,
17
+ 0.27577711
18
+ ],
19
+ "merge_size": 2,
20
+ "patch_size": 14,
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "longest_edge": 12845056,
25
+ "shortest_edge": 3136
26
+ },
27
+ "temporal_patch_size": 2
28
+ },
29
+ "processor_class": "Qwen2_5_VLProcessor",
30
+ "video_processor": {
31
+ "data_format": "channels_first",
32
+ "default_to_square": true,
33
+ "do_convert_rgb": true,
34
+ "do_normalize": true,
35
+ "do_rescale": true,
36
+ "do_resize": true,
37
+ "do_sample_frames": false,
38
+ "image_mean": [
39
+ 0.48145466,
40
+ 0.4578275,
41
+ 0.40821073
42
+ ],
43
+ "image_processor_type": "Qwen2VLImageProcessor",
44
+ "image_std": [
45
+ 0.26862954,
46
+ 0.26130258,
47
+ 0.27577711
48
+ ],
49
+ "max_frames": 768,
50
+ "merge_size": 2,
51
+ "min_frames": 4,
52
+ "patch_size": 14,
53
+ "resample": 3,
54
+ "rescale_factor": 0.00392156862745098,
55
+ "return_metadata": false,
56
+ "size": {
57
+ "longest_edge": 12845056,
58
+ "shortest_edge": 3136
59
+ },
60
+ "temporal_patch_size": 2,
61
+ "video_processor_type": "Qwen2VLVideoProcessor"
62
+ }
63
+ }
pruning_info.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "Qwen/Qwen2.5-VL-7B-Instruct",
3
+ "method": "layer_pruning_ppl",
4
+ "method_name": "PPL-based (Shortened LLaMA)",
5
+ "layers_removed": [
6
+ 6,
7
+ 7,
8
+ 8,
9
+ 11,
10
+ 12,
11
+ 15,
12
+ 16,
13
+ 18
14
+ ],
15
+ "n_layers_original": 28,
16
+ "n_layers_remaining": 20,
17
+ "params_before_M": 8292.2,
18
+ "params_after_M": 6427.7,
19
+ "param_reduction_pct": 22.5,
20
+ "benchmarks": {
21
+ "vqav2": {
22
+ "accuracy": 0.3,
23
+ "avg_latency_s": 0.2063,
24
+ "peak_memory_mb": 16807.1,
25
+ "avg_memory_mb": 16805.2,
26
+ "throughput_sps": 4.84,
27
+ "avg_power_w": 266.2,
28
+ "avg_gpu_util_pct": 81.7,
29
+ "n_samples": 50,
30
+ "n_evaluated": 50,
31
+ "n_skipped": 0,
32
+ "all_failed": false,
33
+ "zero_accuracy_warning": false,
34
+ "metrics": {
35
+ "exact_match": 0.3,
36
+ "contains": 0.5,
37
+ "token_f1": 0.3754,
38
+ "bleu": 0.3619,
39
+ "rouge_l": 0.3754
40
+ }
41
+ }
42
+ }
43
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
3
+ size 11421892
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": false,
24
+ "model_max_length": 131072,
25
+ "pad_token": "<|endoftext|>",
26
+ "processor_class": "Qwen2_5_VLProcessor",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "Qwen2Tokenizer",
29
+ "unk_token": null
30
+ }