5ch4um1 commited on
Commit
76ffe1d
·
verified ·
1 Parent(s): 9ad99d8

Upload folder using huggingface_hub

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token -}}
2
+ {%- set keep_past_thinking = keep_past_thinking | default(false) -%}
3
+
4
+ {%- macro format_arg_value(arg_value) -%}
5
+ {%- if arg_value is string -%}
6
+ {{- '"' + arg_value + '"' -}}
7
+ {%- elif arg_value is mapping -%}
8
+ {{- arg_value | tojson -}}
9
+ {%- else -%}
10
+ {{- arg_value | string -}}
11
+ {%- endif -%}
12
+ {%- endmacro -%}
13
+
14
+ {%- macro parse_content(content) -%}
15
+ {%- if content is string -%}
16
+ {{- content -}}
17
+ {%- else -%}
18
+ {%- set _ns = namespace(result="") -%}
19
+ {%- for item in content -%}
20
+ {%- if item.type == "image" -%}
21
+ {%- set _ns.result = _ns.result + "<image>" -%}
22
+ {%- elif item.type == "text" -%}
23
+ {%- set _ns.result = _ns.result + item.text -%}
24
+ {%- else -%}
25
+ {%- set _ns.result = _ns.result + item | tojson -%}
26
+ {%- endif -%}
27
+ {%- endfor -%}
28
+ {{- _ns.result -}}
29
+ {%- endif -%}
30
+ {%- endmacro -%}
31
+
32
+ {%- macro render_tool_calls(tool_calls) -%}
33
+ {%- set tool_calls_ns = namespace(tool_calls=[]) -%}
34
+ {%- for tool_call in tool_calls -%}
35
+ {%- set func_name = tool_call.function.name -%}
36
+ {%- set func_args = tool_call.function.arguments -%}
37
+ {%- set args_ns = namespace(arg_strings=[]) -%}
38
+ {%- for arg_name, arg_value in func_args.items() -%}
39
+ {%- set args_ns.arg_strings = args_ns.arg_strings + [arg_name + "=" + format_arg_value(arg_value)] -%}
40
+ {%- endfor -%}
41
+ {%- set tool_calls_ns.tool_calls = tool_calls_ns.tool_calls + [func_name + "(" + (args_ns.arg_strings | join(", ")) + ")"] -%}
42
+ {%- endfor -%}
43
+ {{- "<|tool_call_start|>[" + (tool_calls_ns.tool_calls | join(", ")) + "]<|tool_call_end|>" -}}
44
+ {%- endmacro -%}
45
+
46
+ {%- set ns = namespace(system_prompt="", last_assistant_index=-1) -%}
47
+ {%- if messages[0].role == "system" -%}
48
+ {%- if messages[0].content is defined -%}
49
+ {%- set ns.system_prompt = parse_content(messages[0].content) -%}
50
+ {%- endif -%}
51
+ {%- set messages = messages[1:] -%}
52
+ {%- endif -%}
53
+ {%- if tools -%}
54
+ {%- set ns.system_prompt = ns.system_prompt + ("\n\n" if ns.system_prompt else "") + "Today's date: " + strftime_now("%Y-%m-%d") + "\n\nList of tools: " + (tools | tojson) -%}
55
+ {%- endif -%}
56
+ {%- if ns.system_prompt -%}
57
+ {{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
58
+ {%- endif -%}
59
+ {%- for message in messages -%}
60
+ {%- if message.role == "assistant" -%}
61
+ {%- set ns.last_assistant_index = loop.index0 -%}
62
+ {%- endif -%}
63
+ {%- endfor -%}
64
+ {%- for message in messages -%}
65
+ {{- "<|im_start|>" + message.role + "\n" -}}
66
+ {%- if message.role == "assistant" -%}
67
+ {%- generation -%}
68
+ {%- if message.thinking is defined and (keep_past_thinking or loop.index0 == ns.last_assistant_index) -%}
69
+ {{- "<think>" + message.thinking + "</think>" -}}
70
+ {%- endif -%}
71
+ {%- if message.tool_calls is defined -%}
72
+ {{- render_tool_calls(message.tool_calls) -}}
73
+ {%- endif -%}
74
+ {%- if message.content is defined -%}
75
+ {%- set content = parse_content(message.content) -%}
76
+ {%- if not keep_past_thinking and loop.index0 != ns.last_assistant_index -%}
77
+ {%- if "</think>" in content -%}
78
+ {%- set content = content.split("</think>")[-1] | trim -%}
79
+ {%- endif -%}
80
+ {%- endif -%}
81
+ {{- content + ("" if (continue_final_message and loop.last) else "<|im_end|>\n") -}}
82
+ {%- endif -%}
83
+ {%- endgeneration -%}
84
+ {%- else %}
85
+ {%- if message.content is defined -%}
86
+ {{- parse_content(message.content) + "<|im_end|>\n" -}}
87
+ {%- endif -%}
88
+ {%- endif %}
89
+ {%- endfor -%}
90
+ {%- if add_generation_prompt -%}
91
+ {{- "<|im_start|>assistant\n" -}}
92
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Lfm2VlForConditionalGeneration"
4
+ ],
5
+ "do_image_splitting": true,
6
+ "downsample_factor": 2,
7
+ "dtype": "bfloat16",
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": 2048,
19
+ "projector_use_layernorm": false,
20
+ "text_config": {
21
+ "_name_or_path": "LiquidAI/LFM2-350M",
22
+ "architectures": [
23
+ "Lfm2ForCausalLM"
24
+ ],
25
+ "block_auto_adjust_ff_dim": true,
26
+ "block_dim": 1024,
27
+ "block_ffn_dim_multiplier": 1.0,
28
+ "block_mlp_init_scale": 1.0,
29
+ "block_multiple_of": 256,
30
+ "block_norm_eps": 1e-05,
31
+ "block_out_init_scale": 1.0,
32
+ "block_use_swiglu": true,
33
+ "block_use_xavier_init": true,
34
+ "bos_token_id": 1,
35
+ "conv_L_cache": 3,
36
+ "conv_bias": false,
37
+ "conv_dim": 1024,
38
+ "conv_dim_out": 1024,
39
+ "conv_use_xavier_init": true,
40
+ "dtype": "bfloat16",
41
+ "eos_token_id": 7,
42
+ "full_attn_idxs": null,
43
+ "hidden_size": 1024,
44
+ "initializer_range": 0.02,
45
+ "intermediate_size": 6656,
46
+ "layer_types": [
47
+ "conv",
48
+ "conv",
49
+ "full_attention",
50
+ "conv",
51
+ "conv",
52
+ "full_attention",
53
+ "conv",
54
+ "conv",
55
+ "full_attention",
56
+ "conv",
57
+ "full_attention",
58
+ "conv",
59
+ "full_attention",
60
+ "conv",
61
+ "full_attention",
62
+ "conv"
63
+ ],
64
+ "max_position_embeddings": 128000,
65
+ "model_type": "lfm2",
66
+ "norm_eps": 1e-05,
67
+ "num_attention_heads": 16,
68
+ "num_heads": 16,
69
+ "num_hidden_layers": 16,
70
+ "num_key_value_heads": 8,
71
+ "pad_token_id": 0,
72
+ "rope_parameters": {
73
+ "rope_theta": 1000000.0,
74
+ "rope_type": "default"
75
+ },
76
+ "tie_word_embeddings": true,
77
+ "use_cache": true,
78
+ "use_pos_enc": true,
79
+ "vocab_size": 65536
80
+ },
81
+ "tie_word_embeddings": true,
82
+ "tile_size": 512,
83
+ "transformers_version": "5.5.1",
84
+ "use_cache": false,
85
+ "use_image_special_tokens": true,
86
+ "use_thumbnail": true,
87
+ "vision_config": {
88
+ "attention_dropout": 0.0,
89
+ "dtype": "bfloat16",
90
+ "hidden_act": "gelu_pytorch_tanh",
91
+ "hidden_size": 768,
92
+ "intermediate_size": 3072,
93
+ "layer_norm_eps": 1e-06,
94
+ "model_type": "siglip2_vision_model",
95
+ "num_attention_heads": 12,
96
+ "num_channels": 3,
97
+ "num_hidden_layers": 12,
98
+ "num_patches": 256,
99
+ "patch_size": 16,
100
+ "vision_use_head": false
101
+ }
102
+ }
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.5.1"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d07c43e3b20a98164460d66e99eecf8f4f7f718a5c24d30589adf9ea09a6e355
3
+ size 897484568
processor_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "do_image_splitting": true,
5
+ "do_normalize": true,
6
+ "do_pad": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "downsample_factor": 2,
10
+ "encoder_patch_size": 16,
11
+ "image_mean": [
12
+ 0.5,
13
+ 0.5,
14
+ 0.5
15
+ ],
16
+ "image_processor_type": "Lfm2VlImageProcessor",
17
+ "image_std": [
18
+ 0.5,
19
+ 0.5,
20
+ 0.5
21
+ ],
22
+ "max_image_tokens": 256,
23
+ "max_num_patches": 1024,
24
+ "max_pixels_tolerance": 2.0,
25
+ "max_tiles": 10,
26
+ "min_image_tokens": 64,
27
+ "min_tiles": 2,
28
+ "resample": 3,
29
+ "rescale_factor": 0.00392156862745098,
30
+ "return_row_col_info": true,
31
+ "size": {
32
+ "height": 512,
33
+ "width": 512
34
+ },
35
+ "tile_size": 512,
36
+ "use_thumbnail": true
37
+ },
38
+ "processor_class": "Lfm2VlProcessor"
39
+ }
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
+ "backend": "tokenizers",
3
+ "bos_token": "<|startoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "do_image_splitting": true,
6
+ "eos_token": "<|im_end|>",
7
+ "extra_special_tokens": [],
8
+ "image_end_token": "<|image_end|>",
9
+ "image_start_token": "<|image_start|>",
10
+ "image_thumbnail": "<|img_thumbnail|>",
11
+ "image_token": "<image>",
12
+ "is_local": true,
13
+ "legacy": false,
14
+ "local_files_only": 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_token": "<image>"
20
+ },
21
+ "pad_token": "<|pad|>",
22
+ "processor_class": "Lfm2VlProcessor",
23
+ "resample": 3,
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
+ }