Azaz666 commited on
Commit
502e586
·
verified ·
1 Parent(s): be3f357

INT4 quantization of LiquidAI/LFM2-VL-3B (LLM backbone quantized, vision encoder fp16)

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {{bos_token}}{% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ '}}{% if message['content'] is string %}{{ message['content'] }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{{ '<image>' }}{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}{{'<|im_end|>
3
+ '}}{% endfor %}{% if add_generation_prompt %}{{'<|im_start|>assistant
4
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Lfm2VlForConditionalGeneration"
4
+ ],
5
+ "do_image_splitting": true,
6
+ "downsample_factor": 2,
7
+ "dtype": "float16",
8
+ "encoder_patch_size": 16,
9
+ "image_token_id": 396,
10
+ "max_image_tokens": 256,
11
+ "max_pixels_tolerance": 2.0,
12
+ "max_tiles": 10,
13
+ "min_image_tokens": 64,
14
+ "min_tiles": 2,
15
+ "model_type": "lfm2_vl",
16
+ "projector_bias": true,
17
+ "projector_hidden_act": "gelu",
18
+ "projector_hidden_size": 2560,
19
+ "projector_use_layernorm": true,
20
+ "text_config": {
21
+ "_name_or_path": "LiquidAI/LFM2-2.6B",
22
+ "architectures": [
23
+ "Lfm2ForCausalLM"
24
+ ],
25
+ "block_auto_adjust_ff_dim": false,
26
+ "block_dim": 2048,
27
+ "block_ff_dim": 10752,
28
+ "block_ffn_dim_multiplier": 1.0,
29
+ "block_mlp_init_scale": 1.0,
30
+ "block_multiple_of": 256,
31
+ "block_norm_eps": 1e-05,
32
+ "block_out_init_scale": 1.0,
33
+ "block_use_swiglu": true,
34
+ "block_use_xavier_init": true,
35
+ "bos_token_id": 1,
36
+ "conv_L_cache": 3,
37
+ "conv_bias": false,
38
+ "conv_dim": 2048,
39
+ "conv_dim_out": 2048,
40
+ "conv_use_xavier_init": true,
41
+ "dtype": "float16",
42
+ "eos_token_id": 7,
43
+ "hidden_size": 2048,
44
+ "initializer_range": 0.02,
45
+ "intermediate_size": 10752,
46
+ "layer_types": [
47
+ "conv",
48
+ "conv",
49
+ "full_attention",
50
+ "conv",
51
+ "conv",
52
+ "full_attention",
53
+ "conv",
54
+ "conv",
55
+ "conv",
56
+ "full_attention",
57
+ "conv",
58
+ "conv",
59
+ "conv",
60
+ "full_attention",
61
+ "conv",
62
+ "conv",
63
+ "conv",
64
+ "full_attention",
65
+ "conv",
66
+ "conv",
67
+ "conv",
68
+ "full_attention",
69
+ "conv",
70
+ "conv",
71
+ "full_attention",
72
+ "conv",
73
+ "conv",
74
+ "full_attention",
75
+ "conv",
76
+ "conv"
77
+ ],
78
+ "max_position_embeddings": 128000,
79
+ "model_type": "lfm2",
80
+ "norm_eps": 1e-05,
81
+ "num_attention_heads": 32,
82
+ "num_heads": 32,
83
+ "num_hidden_layers": 30,
84
+ "num_key_value_heads": 8,
85
+ "pad_token_id": 0,
86
+ "rope_parameters": {
87
+ "rope_theta": 1000000.0,
88
+ "rope_type": "default"
89
+ },
90
+ "theta": 1000000.0,
91
+ "tie_embedding": true,
92
+ "tie_word_embeddings": true,
93
+ "use_cache": true,
94
+ "use_pos_enc": true,
95
+ "vocab_size": 65536
96
+ },
97
+ "tie_word_embeddings": true,
98
+ "tile_size": 512,
99
+ "transformers_version": "5.3.0",
100
+ "use_image_special_tokens": true,
101
+ "use_thumbnail": true,
102
+ "vision_config": {
103
+ "attention_dropout": 0.0,
104
+ "dtype": "float16",
105
+ "hidden_act": "gelu_pytorch_tanh",
106
+ "hidden_size": 1152,
107
+ "intermediate_size": 4304,
108
+ "layer_norm_eps": 1e-06,
109
+ "model_type": "siglip2_vision_model",
110
+ "num_attention_heads": 16,
111
+ "num_channels": 3,
112
+ "num_hidden_layers": 27,
113
+ "num_patches": 256,
114
+ "patch_size": 16,
115
+ "vision_use_head": false
116
+ }
117
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 7,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "5.3.0"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08cc31871a9217753251d7d1344d95ae47f0e0f9f57ad8535eab17831452e7d8
3
+ size 5998047656
processor_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "do_image_splitting": true,
6
+ "do_normalize": true,
7
+ "do_pad": true,
8
+ "do_rescale": true,
9
+ "do_resize": false,
10
+ "downsample_factor": 2,
11
+ "encoder_patch_size": 16,
12
+ "image_mean": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "image_processor_type": "Lfm2VlImageProcessorFast",
18
+ "image_std": [
19
+ 0.5,
20
+ 0.5,
21
+ 0.5
22
+ ],
23
+ "max_image_tokens": 256,
24
+ "max_num_patches": 1024,
25
+ "max_pixels_tolerance": 2.0,
26
+ "max_tiles": 10,
27
+ "min_image_tokens": 64,
28
+ "min_tiles": 2,
29
+ "resample": 3,
30
+ "rescale_factor": 0.00392156862745098,
31
+ "return_row_col_info": true,
32
+ "size": {
33
+ "height": 512,
34
+ "width": 512
35
+ },
36
+ "tile_size": 512,
37
+ "use_numpy_backend": true,
38
+ "use_thumbnail": true
39
+ },
40
+ "processor_class": "Lfm2VlProcessor"
41
+ }
quantization_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "LiquidAI/LFM2-VL-3B",
3
+ "quantization": "int4_per_group_symmetric",
4
+ "group_size": 128,
5
+ "bits": 4,
6
+ "method": "static_int4_dequantized",
7
+ "description": "INT4 per-group symmetric quantization of LLM backbone weights. Vision encoder kept in fp16. Weights stored as dequantized fp16 for maximum compatibility.",
8
+ "quantized_layers": 167,
9
+ "skipped_vision_layers": 165
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|startoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|im_end|>",
6
+ "image_end_token": "<|image_end|>",
7
+ "image_start_token": "<|image_start|>",
8
+ "image_thumbnail": "<|img_thumbnail|>",
9
+ "image_token": "<image>",
10
+ "is_local": false,
11
+ "legacy": false,
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "model_specific_special_tokens": {
14
+ "image_end_token": "<|image_end|>",
15
+ "image_start_token": "<|image_start|>",
16
+ "image_thumbnail": "<|img_thumbnail|>",
17
+ "image_token": "<image>"
18
+ },
19
+ "pad_token": "<|pad|>",
20
+ "processor_class": "Lfm2VlProcessor",
21
+ "return_token_type_ids": false,
22
+ "sp_model_kwargs": {},
23
+ "spaces_between_special_tokens": false,
24
+ "tokenizer_class": "TokenizersBackend",
25
+ "use_default_system_prompt": false,
26
+ "use_fast": true
27
+ }