new
Browse files- .gitattributes +1 -0
- chat_template.jinja +105 -0
- config.json +69 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +13 -0
.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,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- bos_token -}}
|
| 2 |
+
{%- set preserve_thinking = preserve_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_user_index=-1) -%}
|
| 47 |
+
{%- if messages[0]["role"] == "system" -%}
|
| 48 |
+
{%- if messages[0].get("content") -%}
|
| 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"] == "user" -%}
|
| 61 |
+
{%- set ns.last_user_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 (preserve_thinking or loop.index0 > ns.last_user_index) -%}
|
| 69 |
+
{{- "<think>" + message.thinking + "</think>" -}}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
|
| 72 |
+
{%- set _has_cfm = false -%}
|
| 73 |
+
{%- if message.content is defined -%}
|
| 74 |
+
{%- set content = parse_content(message.content) -%}
|
| 75 |
+
{%- if not (preserve_thinking or loop.index0 > ns.last_user_index) -%}
|
| 76 |
+
{%- if "</think>" in content -%}
|
| 77 |
+
{%- set content = content.split("</think>")[-1] | trim -%}
|
| 78 |
+
{%- endif -%}
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- if message.tool_calls is defined and content.endswith(_cfm_tag) -%}
|
| 81 |
+
{%- set _has_cfm = true -%}
|
| 82 |
+
{%- set _trunc_len = (content | length) - (_cfm_tag | length) -%}
|
| 83 |
+
{{- content[:_trunc_len] -}}
|
| 84 |
+
{%- else -%}
|
| 85 |
+
{{- content -}}
|
| 86 |
+
{%- endif -%}
|
| 87 |
+
{%- endif -%}
|
| 88 |
+
{%- if message.tool_calls is defined -%}
|
| 89 |
+
{{- render_tool_calls(message.tool_calls) -}}
|
| 90 |
+
{%- endif -%}
|
| 91 |
+
{%- if _has_cfm -%}
|
| 92 |
+
{{- _cfm_tag -}}
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{{- "<|im_end|>\n" -}}
|
| 95 |
+
{%- endgeneration -%}
|
| 96 |
+
{%- else %}
|
| 97 |
+
{%- if message.get("content") -%}
|
| 98 |
+
{{- parse_content(message["content"]) -}}
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{{- "<|im_end|>\n" -}}
|
| 101 |
+
{%- endif %}
|
| 102 |
+
{%- endfor -%}
|
| 103 |
+
{%- if add_generation_prompt -%}
|
| 104 |
+
{{- "<|im_start|>assistant\n" -}}
|
| 105 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Lfm2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"block_auto_adjust_ff_dim": false,
|
| 6 |
+
"block_dim": 2048,
|
| 7 |
+
"block_ffn_dim_multiplier": 1.0,
|
| 8 |
+
"block_mlp_init_scale": 1.0,
|
| 9 |
+
"block_multiple_of": 256,
|
| 10 |
+
"block_norm_eps": 1e-05,
|
| 11 |
+
"block_out_init_scale": 1.0,
|
| 12 |
+
"block_use_swiglu": true,
|
| 13 |
+
"block_use_xavier_init": true,
|
| 14 |
+
"bos_token_id": 124894,
|
| 15 |
+
"conv_L_cache": 3,
|
| 16 |
+
"conv_bias": false,
|
| 17 |
+
"conv_dim": 2048,
|
| 18 |
+
"conv_use_xavier_init": true,
|
| 19 |
+
"dtype": "bfloat16",
|
| 20 |
+
"eos_token_id": 124900,
|
| 21 |
+
"hidden_size": 2048,
|
| 22 |
+
"initializer_range": 0.02,
|
| 23 |
+
"intermediate_size": 10752,
|
| 24 |
+
"layer_types": [
|
| 25 |
+
"conv",
|
| 26 |
+
"conv",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"conv",
|
| 29 |
+
"conv",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"conv",
|
| 32 |
+
"conv",
|
| 33 |
+
"conv",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"conv",
|
| 36 |
+
"conv",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"conv",
|
| 39 |
+
"conv",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"conv",
|
| 42 |
+
"conv",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"conv",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"conv",
|
| 47 |
+
"conv",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"conv",
|
| 50 |
+
"conv"
|
| 51 |
+
],
|
| 52 |
+
"max_position_embeddings": 128000,
|
| 53 |
+
"model_type": "lfm2",
|
| 54 |
+
"norm_eps": 1e-05,
|
| 55 |
+
"num_attention_heads": 32,
|
| 56 |
+
"num_heads": 32,
|
| 57 |
+
"num_hidden_layers": 26,
|
| 58 |
+
"num_key_value_heads": 8,
|
| 59 |
+
"pad_token_id": 124893,
|
| 60 |
+
"rope_parameters": {
|
| 61 |
+
"rope_theta": 10000000.0,
|
| 62 |
+
"rope_type": "default"
|
| 63 |
+
},
|
| 64 |
+
"tie_word_embeddings": true,
|
| 65 |
+
"transformers_version": "5.9.0",
|
| 66 |
+
"use_cache": true,
|
| 67 |
+
"use_pos_enc": true,
|
| 68 |
+
"vocab_size": 128000
|
| 69 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 124894,
|
| 4 |
+
"eos_token_id": 124900,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 124893,
|
| 8 |
+
"transformers_version": "5.9.0",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa3b74c26728554720e04c94a1edab75ee53e286e14b7f25629a08d889e07700
|
| 3 |
+
size 4731641832
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbe0331832280d8f486ccb65ba342197624e7b34cdcdf6d07d8866370da41e5d
|
| 3 |
+
size 17905590
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|startoftext|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|im_end|>",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"legacy": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 10 |
+
"pad_token": "<|pad|>",
|
| 11 |
+
"tokenizer_class": "TokenizersBackend",
|
| 12 |
+
"use_default_system_prompt": false
|
| 13 |
+
}
|