Azaz666 commited on
Commit
08416be
·
verified ·
1 Parent(s): 6a6e22a

INT4 quantization of LiquidAI/LFM2-VL-1.6B (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,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "image_token_index": 396,
11
+ "max_image_tokens": 256,
12
+ "max_num_patches": 1024,
13
+ "max_pixels_tolerance": 1.5,
14
+ "max_tiles": 10,
15
+ "min_image_tokens": 64,
16
+ "min_tiles": 2,
17
+ "model_type": "lfm2_vl",
18
+ "projector_bias": true,
19
+ "projector_hidden_act": "gelu",
20
+ "projector_hidden_size": 2560,
21
+ "projector_use_layernorm": true,
22
+ "text_config": {
23
+ "_name_or_path": "LiquidAI/LFM2-1.2B",
24
+ "architectures": [
25
+ "Lfm2ForCausalLM"
26
+ ],
27
+ "block_auto_adjust_ff_dim": true,
28
+ "block_dim": 2048,
29
+ "block_ff_dim": 12288,
30
+ "block_ffn_dim_multiplier": 1.0,
31
+ "block_mlp_init_scale": 1.0,
32
+ "block_multiple_of": 256,
33
+ "block_norm_eps": 1e-05,
34
+ "block_out_init_scale": 1.0,
35
+ "block_use_swiglu": true,
36
+ "block_use_xavier_init": true,
37
+ "bos_token_id": 1,
38
+ "conv_L_cache": 3,
39
+ "conv_bias": false,
40
+ "conv_dim": 2048,
41
+ "conv_dim_out": 2048,
42
+ "conv_use_xavier_init": true,
43
+ "dtype": "float16",
44
+ "eos_token_id": 7,
45
+ "hidden_size": 2048,
46
+ "initializer_range": 0.02,
47
+ "intermediate_size": 12288,
48
+ "layer_types": [
49
+ "conv",
50
+ "conv",
51
+ "full_attention",
52
+ "conv",
53
+ "conv",
54
+ "full_attention",
55
+ "conv",
56
+ "conv",
57
+ "full_attention",
58
+ "conv",
59
+ "full_attention",
60
+ "conv",
61
+ "full_attention",
62
+ "conv",
63
+ "full_attention",
64
+ "conv"
65
+ ],
66
+ "max_position_embeddings": 128000,
67
+ "model_type": "lfm2",
68
+ "norm_eps": 1e-05,
69
+ "num_attention_heads": 32,
70
+ "num_heads": 32,
71
+ "num_hidden_layers": 16,
72
+ "num_key_value_heads": 8,
73
+ "pad_token_id": 0,
74
+ "rope_parameters": {
75
+ "rope_theta": 1000000.0,
76
+ "rope_type": "default"
77
+ },
78
+ "tie_word_embeddings": true,
79
+ "use_cache": true,
80
+ "use_pos_enc": true,
81
+ "vocab_size": 65536
82
+ },
83
+ "tie_word_embeddings": true,
84
+ "tile_size": 512,
85
+ "transformers_version": "5.3.0",
86
+ "use_image_special_tokens": true,
87
+ "use_thumbnail": true,
88
+ "vision_config": {
89
+ "attention_dropout": 0.0,
90
+ "dtype": "float16",
91
+ "hidden_act": "gelu_pytorch_tanh",
92
+ "hidden_size": 1152,
93
+ "intermediate_size": 4304,
94
+ "layer_norm_eps": 1e-06,
95
+ "model_type": "siglip2_vision_model",
96
+ "num_attention_heads": 16,
97
+ "num_channels": 3,
98
+ "num_hidden_layers": 26,
99
+ "num_patches": 256,
100
+ "patch_size": 16,
101
+ "vision_use_head": false
102
+ }
103
+ }
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:f3cc5f7aa71b18f5b230669b2e6eefc9dbef47a410b055e6bca582739e06b890
3
+ size 3169687752
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
+ "patch_size": 16,
30
+ "resample": 3,
31
+ "rescale_factor": 0.00392156862745098,
32
+ "return_row_col_info": true,
33
+ "size": {
34
+ "height": 512,
35
+ "width": 512
36
+ },
37
+ "tile_size": 512,
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-1.6B",
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": 93,
9
+ "skipped_vision_layers": 159
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "processing_lfm2_vl.Lfm2VlProcessor"
4
+ },
5
+ "backend": "tokenizers",
6
+ "bos_token": "<|startoftext|>",
7
+ "clean_up_tokenization_spaces": true,
8
+ "eos_token": "<|im_end|>",
9
+ "image_end_token": "<|image_end|>",
10
+ "image_start_token": "<|image_start|>",
11
+ "image_thumbnail": "<|img_thumbnail|>",
12
+ "image_token": "<image>",
13
+ "is_local": false,
14
+ "legacy": false,
15
+ "model_max_length": 1000000000000000019884624838656,
16
+ "model_specific_special_tokens": {
17
+ "image_end_token": "<|image_end|>",
18
+ "image_start_token": "<|image_start|>",
19
+ "image_thumbnail": "<|img_thumbnail|>",
20
+ "image_token": "<image>"
21
+ },
22
+ "pad_token": "<|pad|>",
23
+ "processor_class": "Lfm2VlProcessor",
24
+ "return_token_type_ids": false,
25
+ "sp_model_kwargs": {},
26
+ "spaces_between_special_tokens": false,
27
+ "tokenizer_class": "TokenizersBackend",
28
+ "use_default_system_prompt": false,
29
+ "use_fast": true
30
+ }