Text Generation
Safetensors
NemotronH_Nano_Omni_Reasoning_V3
nvidia
unsloth
nemotron-3
multimodal
conversational
custom_code
Instructions to use unsloth/NVIDIA-Nemotron-3-Nano-Omni-30B-A3B-Reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps Settings
- Unsloth Desktop
Upload folder using huggingface_hub
Browse files- chat_template.jinja +3 -3
- config.json +131 -69
- preprocessor_config.json +36 -9
- processor_config.json +9 -0
- special_tokens_map.json +7 -0
- tokenizer.json +2 -2
- tokenizer_config.json +8 -2
chat_template.jinja
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
{%- if json_dict is mapping %}
|
| 3 |
{%- for json_key in json_dict if json_key not in handled_keys %}
|
| 4 |
{%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
|
| 5 |
-
{{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson
|
| 6 |
{%- else %}
|
| 7 |
{{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
|
| 8 |
{%- endif %}
|
|
@@ -100,7 +100,7 @@
|
|
| 100 |
{{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
|
| 101 |
{%- endif %}
|
| 102 |
{%- if param_fields.enum is defined %}
|
| 103 |
-
{{- '\n<enum>' ~ (param_fields.enum | tojson
|
| 104 |
{%- endif %}
|
| 105 |
{%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
|
| 106 |
{{- render_extra_keys(param_fields, handled_keys) }}
|
|
@@ -110,7 +110,7 @@
|
|
| 110 |
{%- set handled_keys = ['type', 'properties', 'required'] %}
|
| 111 |
{{- render_extra_keys(tool.parameters, handled_keys) }}
|
| 112 |
{%- if tool.parameters is defined and tool.parameters.required is defined %}
|
| 113 |
-
{{- '\n<required>' ~ (tool.parameters.required | tojson
|
| 114 |
{%- endif %}
|
| 115 |
{{- '\n</parameters>' }}
|
| 116 |
{%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
|
|
|
|
| 2 |
{%- if json_dict is mapping %}
|
| 3 |
{%- for json_key in json_dict if json_key not in handled_keys %}
|
| 4 |
{%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
|
| 5 |
+
{{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson ) ~ '</' ~ json_key ~ '>' }}
|
| 6 |
{%- else %}
|
| 7 |
{{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
|
| 8 |
{%- endif %}
|
|
|
|
| 100 |
{{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
|
| 101 |
{%- endif %}
|
| 102 |
{%- if param_fields.enum is defined %}
|
| 103 |
+
{{- '\n<enum>' ~ (param_fields.enum | tojson ) ~ '</enum>' }}
|
| 104 |
{%- endif %}
|
| 105 |
{%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
|
| 106 |
{{- render_extra_keys(param_fields, handled_keys) }}
|
|
|
|
| 110 |
{%- set handled_keys = ['type', 'properties', 'required'] %}
|
| 111 |
{{- render_extra_keys(tool.parameters, handled_keys) }}
|
| 112 |
{%- if tool.parameters is defined and tool.parameters.required is defined %}
|
| 113 |
+
{{- '\n<required>' ~ (tool.parameters.required | tojson ) ~ '</required>' }}
|
| 114 |
{%- endif %}
|
| 115 |
{{- '\n</parameters>' }}
|
| 116 |
{%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
|
config.json
CHANGED
|
@@ -7,74 +7,30 @@
|
|
| 7 |
"AutoModel": "modeling.NemotronH_Nano_Omni_Reasoning_V3",
|
| 8 |
"AutoModelForCausalLM": "modeling.NemotronH_Nano_Omni_Reasoning_V3"
|
| 9 |
},
|
| 10 |
-
"max_sequence_length": 131072,
|
| 11 |
"downsample_ratio": 0.5,
|
| 12 |
-
"force_image_size": 512,
|
| 13 |
-
"patch_size": 16,
|
| 14 |
-
"use_thumbnail": true,
|
| 15 |
-
"eos_token_id": 11,
|
| 16 |
-
"model_type": "NemotronH_Nano_Omni_Reasoning_V3",
|
| 17 |
-
"ps_version": "v2",
|
| 18 |
-
"template": "n5h_5p5_nanov2",
|
| 19 |
"torch_dtype": "bfloat16",
|
|
|
|
|
|
|
| 20 |
"image_tag_type": "internvl",
|
| 21 |
-
"img_context_token_id": 18,
|
| 22 |
-
"video_context_token_id": 131081,
|
| 23 |
"img_context_token": "<image>",
|
| 24 |
-
"
|
| 25 |
-
"img_start_token": "<img>",
|
| 26 |
"img_end_token": "</img>",
|
| 27 |
-
"
|
| 28 |
-
"projector_hidden_size": 20480,
|
| 29 |
-
"norm_mean": [
|
| 30 |
-
0.48145466,
|
| 31 |
-
0.4578275,
|
| 32 |
-
0.40821073
|
| 33 |
-
],
|
| 34 |
-
"norm_std": [
|
| 35 |
-
0.26862954,
|
| 36 |
-
0.26130258,
|
| 37 |
-
0.27577711
|
| 38 |
-
],
|
| 39 |
-
"video_pruning_rate": 0.7,
|
| 40 |
-
"sound_context_token_id": 27,
|
| 41 |
-
"sound_context_token": "<so_embedding>",
|
| 42 |
-
"sound_config": {
|
| 43 |
-
"model_type": "parakeet",
|
| 44 |
-
"hidden_size": 1024,
|
| 45 |
-
"num_attention_heads": 8,
|
| 46 |
-
"num_hidden_layers": 24,
|
| 47 |
-
"intermediate_size": 4096,
|
| 48 |
-
"conv_kernel_size": 9,
|
| 49 |
-
"convolution_bias": false,
|
| 50 |
-
"subsampling_conv_channels": 256,
|
| 51 |
-
"subsampling_conv_kernel_size": 3,
|
| 52 |
-
"subsampling_conv_stride": 2,
|
| 53 |
-
"subsampling_factor": 8,
|
| 54 |
-
"num_mel_bins": 128,
|
| 55 |
-
"projection_hidden_size": 4096,
|
| 56 |
-
"projection_bias": false,
|
| 57 |
-
"sampling_rate": 16000
|
| 58 |
-
},
|
| 59 |
"llm_config": {
|
| 60 |
"architectures": [
|
| 61 |
"NemotronHForCausalLM"
|
| 62 |
],
|
|
|
|
|
|
|
| 63 |
"auto_map": {
|
| 64 |
"AutoConfig": "configuration_nemotron_h.NemotronHConfig",
|
| 65 |
"AutoModelForCausalLM": "modeling_nemotron_h.NemotronHForCausalLM"
|
| 66 |
},
|
| 67 |
-
"model_type": "nemotron_h",
|
| 68 |
-
"bos_token_id": 1,
|
| 69 |
"chunk_size": 128,
|
| 70 |
"conv_kernel": 4,
|
| 71 |
-
"expand": 2,
|
| 72 |
-
"eos_token_id": 11,
|
| 73 |
-
"pad_token_id": 0,
|
| 74 |
"torch_dtype": "bfloat16",
|
| 75 |
-
"
|
| 76 |
-
"
|
| 77 |
-
"attention_dropout": 0.0,
|
| 78 |
"head_dim": 128,
|
| 79 |
"hidden_dropout": 0.0,
|
| 80 |
"hidden_size": 2688,
|
|
@@ -89,6 +45,7 @@
|
|
| 89 |
"max_position_embeddings": 262144,
|
| 90 |
"mlp_bias": false,
|
| 91 |
"mlp_hidden_act": "relu2",
|
|
|
|
| 92 |
"moe_intermediate_size": 1856,
|
| 93 |
"moe_shared_expert_intermediate_size": 3712,
|
| 94 |
"n_group": 1,
|
|
@@ -109,7 +66,6 @@
|
|
| 109 |
"routed_scaling_factor": 2.5,
|
| 110 |
"sliding_window": null,
|
| 111 |
"ssm_state_size": 128,
|
| 112 |
-
"tie_word_embeddings": false,
|
| 113 |
"time_step_floor": 0.0001,
|
| 114 |
"time_step_limit": [
|
| 115 |
0.0,
|
|
@@ -124,11 +80,110 @@
|
|
| 124 |
"use_mamba_kernels": true,
|
| 125 |
"vocab_size": 131072
|
| 126 |
},
|
| 127 |
-
"
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
"adaptor_configs": {},
|
| 133 |
"adaptor_names": null,
|
| 134 |
"architectures": [
|
|
@@ -178,7 +233,6 @@
|
|
| 178 |
"drop_block": null,
|
| 179 |
"drop_connect": null,
|
| 180 |
"drop_path": null,
|
| 181 |
-
"dtype": "bfloat16",
|
| 182 |
"epoch_repeats": 0.0,
|
| 183 |
"eval": false,
|
| 184 |
"eval_metric": "knn_top1",
|
|
@@ -224,9 +278,11 @@
|
|
| 224 |
"lr_noise": null,
|
| 225 |
"lr_noise_pct": 0.67,
|
| 226 |
"lr_noise_std": 1.0,
|
|
|
|
| 227 |
"mean": null,
|
| 228 |
"mesa": false,
|
| 229 |
"min_lr": 0,
|
|
|
|
| 230 |
"mixup": 0.0,
|
| 231 |
"mixup_mode": "batch",
|
| 232 |
"mixup_off_epoch": 0,
|
|
@@ -318,6 +374,7 @@
|
|
| 318 |
"use_summary": false
|
| 319 |
}
|
| 320 |
],
|
|
|
|
| 321 |
"torchcompile": null,
|
| 322 |
"torchscript": false,
|
| 323 |
"train_interpolation": "random",
|
|
@@ -337,27 +394,32 @@
|
|
| 337 |
"warmup_prefix": false,
|
| 338 |
"worker_seeding": "all",
|
| 339 |
"workers": 8,
|
| 340 |
-
"world_size": 256
|
| 341 |
-
"min_num_patches": 1024,
|
| 342 |
-
"max_num_patches": 13312
|
| 343 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
"feature_normalizer_config": null,
|
| 345 |
"inter_feature_normalizer_config": null,
|
|
|
|
| 346 |
"max_resolution": 2048,
|
|
|
|
|
|
|
| 347 |
"patch_size": 16,
|
| 348 |
"preferred_resolution": [
|
| 349 |
768,
|
| 350 |
768
|
| 351 |
],
|
| 352 |
-
"
|
|
|
|
| 353 |
"version": "radio_v2.5-h",
|
| 354 |
-
"vitdet_window_size": null,
|
| 355 |
-
"min_num_patches": 1024,
|
| 356 |
-
"max_num_patches": 13312,
|
| 357 |
-
"video_target_num_patches": 1024,
|
| 358 |
"video_maintain_aspect_ratio": true,
|
| 359 |
-
"video_temporal_patch_size": 2,
|
| 360 |
"video_prompt_version": 2,
|
| 361 |
-
"
|
| 362 |
-
|
|
|
|
|
|
|
|
|
|
| 363 |
}
|
|
|
|
| 7 |
"AutoModel": "modeling.NemotronH_Nano_Omni_Reasoning_V3",
|
| 8 |
"AutoModelForCausalLM": "modeling.NemotronH_Nano_Omni_Reasoning_V3"
|
| 9 |
},
|
|
|
|
| 10 |
"downsample_ratio": 0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
"torch_dtype": "bfloat16",
|
| 12 |
+
"eos_token_id": 11,
|
| 13 |
+
"force_image_size": 512,
|
| 14 |
"image_tag_type": "internvl",
|
|
|
|
|
|
|
| 15 |
"img_context_token": "<image>",
|
| 16 |
+
"img_context_token_id": 18,
|
|
|
|
| 17 |
"img_end_token": "</img>",
|
| 18 |
+
"img_start_token": "<img>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
"llm_config": {
|
| 20 |
"architectures": [
|
| 21 |
"NemotronHForCausalLM"
|
| 22 |
],
|
| 23 |
+
"attention_bias": false,
|
| 24 |
+
"attention_dropout": 0.0,
|
| 25 |
"auto_map": {
|
| 26 |
"AutoConfig": "configuration_nemotron_h.NemotronHConfig",
|
| 27 |
"AutoModelForCausalLM": "modeling_nemotron_h.NemotronHForCausalLM"
|
| 28 |
},
|
|
|
|
|
|
|
| 29 |
"chunk_size": 128,
|
| 30 |
"conv_kernel": 4,
|
|
|
|
|
|
|
|
|
|
| 31 |
"torch_dtype": "bfloat16",
|
| 32 |
+
"eos_token_id": 11,
|
| 33 |
+
"expand": 2,
|
|
|
|
| 34 |
"head_dim": 128,
|
| 35 |
"hidden_dropout": 0.0,
|
| 36 |
"hidden_size": 2688,
|
|
|
|
| 45 |
"max_position_embeddings": 262144,
|
| 46 |
"mlp_bias": false,
|
| 47 |
"mlp_hidden_act": "relu2",
|
| 48 |
+
"model_type": "nemotron_h",
|
| 49 |
"moe_intermediate_size": 1856,
|
| 50 |
"moe_shared_expert_intermediate_size": 3712,
|
| 51 |
"n_group": 1,
|
|
|
|
| 66 |
"routed_scaling_factor": 2.5,
|
| 67 |
"sliding_window": null,
|
| 68 |
"ssm_state_size": 128,
|
|
|
|
| 69 |
"time_step_floor": 0.0001,
|
| 70 |
"time_step_limit": [
|
| 71 |
0.0,
|
|
|
|
| 80 |
"use_mamba_kernels": true,
|
| 81 |
"vocab_size": 131072
|
| 82 |
},
|
| 83 |
+
"max_sequence_length": 131072,
|
| 84 |
+
"model_type": "NemotronH_Nano_Omni_Reasoning_V3",
|
| 85 |
+
"norm_mean": [
|
| 86 |
+
0.48145466,
|
| 87 |
+
0.4578275,
|
| 88 |
+
0.40821073
|
| 89 |
+
],
|
| 90 |
+
"norm_std": [
|
| 91 |
+
0.26862954,
|
| 92 |
+
0.26130258,
|
| 93 |
+
0.27577711
|
| 94 |
+
],
|
| 95 |
+
"pad_token_id": 999,
|
| 96 |
+
"patch_size": 16,
|
| 97 |
+
"projector_hidden_size": 20480,
|
| 98 |
+
"ps_version": "v2",
|
| 99 |
+
"sound_config": {
|
| 100 |
+
"_name_or_path": "",
|
| 101 |
+
"add_cross_attention": false,
|
| 102 |
+
"architectures": null,
|
| 103 |
+
"bad_words_ids": null,
|
| 104 |
+
"begin_suppress_tokens": null,
|
| 105 |
+
"bos_token_id": null,
|
| 106 |
+
"chunk_size_feed_forward": 0,
|
| 107 |
+
"conv_kernel_size": 9,
|
| 108 |
+
"convolution_bias": false,
|
| 109 |
+
"cross_attention_hidden_size": null,
|
| 110 |
+
"decoder_start_token_id": null,
|
| 111 |
+
"diversity_penalty": 0.0,
|
| 112 |
+
"do_sample": false,
|
| 113 |
+
"torch_dtype": null,
|
| 114 |
+
"early_stopping": false,
|
| 115 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 116 |
+
"eos_token_id": null,
|
| 117 |
+
"exponential_decay_length_penalty": null,
|
| 118 |
+
"feat_in": 80,
|
| 119 |
+
"finetuning_task": null,
|
| 120 |
+
"forced_bos_token_id": null,
|
| 121 |
+
"forced_eos_token_id": null,
|
| 122 |
+
"hidden_size": 1024,
|
| 123 |
+
"id2label": {
|
| 124 |
+
"0": "LABEL_0",
|
| 125 |
+
"1": "LABEL_1"
|
| 126 |
+
},
|
| 127 |
+
"intermediate_size": 4096,
|
| 128 |
+
"is_decoder": false,
|
| 129 |
+
"is_encoder_decoder": false,
|
| 130 |
+
"label2id": {
|
| 131 |
+
"LABEL_0": 0,
|
| 132 |
+
"LABEL_1": 1
|
| 133 |
},
|
| 134 |
+
"length_penalty": 1.0,
|
| 135 |
+
"max_length": 20,
|
| 136 |
+
"min_length": 0,
|
| 137 |
+
"model_type": "parakeet",
|
| 138 |
+
"no_repeat_ngram_size": 0,
|
| 139 |
+
"num_attention_heads": 8,
|
| 140 |
+
"num_beam_groups": 1,
|
| 141 |
+
"num_beams": 1,
|
| 142 |
+
"num_hidden_layers": 24,
|
| 143 |
+
"num_mel_bins": 128,
|
| 144 |
+
"num_return_sequences": 1,
|
| 145 |
+
"output_attentions": false,
|
| 146 |
+
"output_hidden_states": false,
|
| 147 |
+
"output_scores": false,
|
| 148 |
+
"pad_token_id": null,
|
| 149 |
+
"prefix": null,
|
| 150 |
+
"problem_type": null,
|
| 151 |
+
"projection_bias": false,
|
| 152 |
+
"projection_hidden_size": 4096,
|
| 153 |
+
"pruned_heads": {},
|
| 154 |
+
"remove_invalid_values": false,
|
| 155 |
+
"repetition_penalty": 1.0,
|
| 156 |
+
"return_dict": true,
|
| 157 |
+
"return_dict_in_generate": false,
|
| 158 |
+
"sampling_rate": 16000,
|
| 159 |
+
"sep_token_id": null,
|
| 160 |
+
"subsampling_conv_channels": 256,
|
| 161 |
+
"subsampling_conv_kernel_size": 3,
|
| 162 |
+
"subsampling_conv_stride": 2,
|
| 163 |
+
"subsampling_factor": 8,
|
| 164 |
+
"suppress_tokens": null,
|
| 165 |
+
"task_specific_params": null,
|
| 166 |
+
"temperature": 1.0,
|
| 167 |
+
"tf_legacy_loss": false,
|
| 168 |
+
"tie_encoder_decoder": false,
|
| 169 |
+
"tie_word_embeddings": true,
|
| 170 |
+
"tokenizer_class": null,
|
| 171 |
+
"top_k": 50,
|
| 172 |
+
"top_p": 1.0,
|
| 173 |
+
"torchscript": false,
|
| 174 |
+
"typical_p": 1.0,
|
| 175 |
+
"use_bfloat16": false
|
| 176 |
+
},
|
| 177 |
+
"sound_context_token": "<so_embedding>",
|
| 178 |
+
"sound_context_token_id": 27,
|
| 179 |
+
"template": "n5h_5p5_nanov2",
|
| 180 |
+
"transformers_version": "4.57.6",
|
| 181 |
+
"unsloth_fixed": true,
|
| 182 |
+
"use_thumbnail": true,
|
| 183 |
+
"video_context_token": "<video>",
|
| 184 |
+
"video_context_token_id": 131081,
|
| 185 |
+
"video_pruning_rate": 0.7,
|
| 186 |
+
"vision_config": {
|
| 187 |
"adaptor_configs": {},
|
| 188 |
"adaptor_names": null,
|
| 189 |
"architectures": [
|
|
|
|
| 233 |
"drop_block": null,
|
| 234 |
"drop_connect": null,
|
| 235 |
"drop_path": null,
|
|
|
|
| 236 |
"epoch_repeats": 0.0,
|
| 237 |
"eval": false,
|
| 238 |
"eval_metric": "knn_top1",
|
|
|
|
| 278 |
"lr_noise": null,
|
| 279 |
"lr_noise_pct": 0.67,
|
| 280 |
"lr_noise_std": 1.0,
|
| 281 |
+
"max_num_patches": 13312,
|
| 282 |
"mean": null,
|
| 283 |
"mesa": false,
|
| 284 |
"min_lr": 0,
|
| 285 |
+
"min_num_patches": 1024,
|
| 286 |
"mixup": 0.0,
|
| 287 |
"mixup_mode": "batch",
|
| 288 |
"mixup_off_epoch": 0,
|
|
|
|
| 374 |
"use_summary": false
|
| 375 |
}
|
| 376 |
],
|
| 377 |
+
"torch_dtype": "bfloat16",
|
| 378 |
"torchcompile": null,
|
| 379 |
"torchscript": false,
|
| 380 |
"train_interpolation": "random",
|
|
|
|
| 394 |
"warmup_prefix": false,
|
| 395 |
"worker_seeding": "all",
|
| 396 |
"workers": 8,
|
| 397 |
+
"world_size": 256
|
|
|
|
|
|
|
| 398 |
},
|
| 399 |
+
"auto_map": {
|
| 400 |
+
"AutoConfig": "nvidia/C-RADIOv2-H--hf_model.RADIOConfig",
|
| 401 |
+
"AutoModel": "nvidia/C-RADIOv2-H--hf_model.RADIOModel"
|
| 402 |
+
},
|
| 403 |
+
"torch_dtype": "bfloat16",
|
| 404 |
"feature_normalizer_config": null,
|
| 405 |
"inter_feature_normalizer_config": null,
|
| 406 |
+
"max_num_patches": 13312,
|
| 407 |
"max_resolution": 2048,
|
| 408 |
+
"min_num_patches": 1024,
|
| 409 |
+
"model_type": "",
|
| 410 |
"patch_size": 16,
|
| 411 |
"preferred_resolution": [
|
| 412 |
768,
|
| 413 |
768
|
| 414 |
],
|
| 415 |
+
"separate_video_embedder": true,
|
| 416 |
+
"use_flash_attn": false,
|
| 417 |
"version": "radio_v2.5-h",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
"video_maintain_aspect_ratio": true,
|
|
|
|
| 419 |
"video_prompt_version": 2,
|
| 420 |
+
"video_target_num_patches": 1024,
|
| 421 |
+
"video_temporal_patch_size": 2,
|
| 422 |
+
"vitdet_window_size": null
|
| 423 |
+
},
|
| 424 |
+
"vit_hidden_size": 1280
|
| 425 |
}
|
preprocessor_config.json
CHANGED
|
@@ -1,15 +1,42 @@
|
|
| 1 |
{
|
| 2 |
-
"image_processor_type": "NemotronH_Nano_Omni_Reasoning_V3ImageProcessor",
|
| 3 |
"auto_map": {
|
| 4 |
"AutoImageProcessor": "image_processing.NemotronH_Nano_Omni_Reasoning_V3ImageProcessor",
|
| 5 |
-
"
|
| 6 |
-
"
|
| 7 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"image_size": 512,
|
| 9 |
-
"
|
| 10 |
-
"
|
| 11 |
"max_num_tiles": 12,
|
| 12 |
-
"
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"auto_map": {
|
| 3 |
"AutoImageProcessor": "image_processing.NemotronH_Nano_Omni_Reasoning_V3ImageProcessor",
|
| 4 |
+
"AutoProcessor": "processing.NemotronH_Nano_Omni_Reasoning_V3Processor",
|
| 5 |
+
"AutoVideoProcessor": "video_processing.NemotronH_Nano_Omni_Reasoning_V3VideoProcessor"
|
| 6 |
},
|
| 7 |
+
"crop_size": null,
|
| 8 |
+
"data_format": "channels_first",
|
| 9 |
+
"default_to_square": true,
|
| 10 |
+
"device": null,
|
| 11 |
+
"disable_grouping": null,
|
| 12 |
+
"do_center_crop": null,
|
| 13 |
+
"do_convert_rgb": null,
|
| 14 |
+
"do_normalize": null,
|
| 15 |
+
"do_pad": null,
|
| 16 |
+
"do_rescale": true,
|
| 17 |
+
"do_resize": null,
|
| 18 |
+
"image_mean": null,
|
| 19 |
+
"image_processor_type": "NemotronH_Nano_Omni_Reasoning_V3ImageProcessor",
|
| 20 |
"image_size": 512,
|
| 21 |
+
"image_std": null,
|
| 22 |
+
"input_data_format": null,
|
| 23 |
"max_num_tiles": 12,
|
| 24 |
+
"norm_mean": [
|
| 25 |
+
0.48145466,
|
| 26 |
+
0.4578275,
|
| 27 |
+
0.40821073
|
| 28 |
+
],
|
| 29 |
+
"norm_std": [
|
| 30 |
+
0.26862954,
|
| 31 |
+
0.26130258,
|
| 32 |
+
0.27577711
|
| 33 |
+
],
|
| 34 |
+
"num_image_token": 256,
|
| 35 |
+
"pad_size": null,
|
| 36 |
+
"processor_class": "NemotronH_Nano_Omni_Reasoning_V3Processor",
|
| 37 |
+
"resample": null,
|
| 38 |
+
"rescale_factor": 0.00392156862745098,
|
| 39 |
+
"return_tensors": null,
|
| 40 |
+
"size": null,
|
| 41 |
+
"use_thumbnail": true
|
| 42 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_hop_length": 160,
|
| 3 |
+
"audio_sampling_rate": 16000,
|
| 4 |
+
"audio_subsampling_factor": 8,
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoProcessor": "processing.NemotronH_Nano_Omni_Reasoning_V3Processor"
|
| 7 |
+
},
|
| 8 |
+
"processor_class": "NemotronH_Nano_Omni_Reasoning_V3Processor"
|
| 9 |
+
}
|
special_tokens_map.json
CHANGED
|
@@ -13,6 +13,13 @@
|
|
| 13 |
"rstrip": false,
|
| 14 |
"single_word": false
|
| 15 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"unk_token": {
|
| 17 |
"content": "<unk>",
|
| 18 |
"lstrip": false,
|
|
|
|
| 13 |
"rstrip": false,
|
| 14 |
"single_word": false
|
| 15 |
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<SPECIAL_999>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
"unk_token": {
|
| 24 |
"content": "<unk>",
|
| 25 |
"lstrip": false,
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d0432ad8b1c2984a2e2dca82e1933e3fd5628df6e95c51fba4c3ee9950dce299
|
| 3 |
+
size 17077366
|
tokenizer_config.json
CHANGED
|
@@ -8004,6 +8004,9 @@
|
|
| 8004 |
"special": true
|
| 8005 |
}
|
| 8006 |
},
|
|
|
|
|
|
|
|
|
|
| 8007 |
"bos_token": "<s>",
|
| 8008 |
"clean_up_tokenization_spaces": false,
|
| 8009 |
"eos_token": "<|im_end|>",
|
|
@@ -8013,7 +8016,10 @@
|
|
| 8013 |
"attention_mask"
|
| 8014 |
],
|
| 8015 |
"model_max_length": 262144,
|
|
|
|
|
|
|
|
|
|
| 8016 |
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 8017 |
"unk_token": "<unk>",
|
| 8018 |
-
"chat_template": "{% macro render_extra_keys(json_dict, handled_keys) %}\n {%- if json_dict is mapping %}\n {%- for json_key in json_dict if json_key not in handled_keys %}\n {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}\n {{- '\\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}\n {%- else %}\n {{-'\\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n{% endmacro %}\n{%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}\n{%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}\n\n{%- set ns = namespace(last_user_idx = -1) %}\n{%- set loop_messages = messages %}\n{%- for m in loop_messages %}\n {%- if m[\"role\"] == \"user\" %}\n {%- set ns.last_user_idx = loop.index0 %}\n {%- endif %}\n{%- endfor %}\n\n{%- if messages[0][\"role\"] == \"system\" %}\n {%- set system_message = messages[0][\"content\"] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n {%- set loop_messages = messages %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = [] %}\n{%- endif %}\n{# Recompute last_user_idx relative to loop_messages after handling system #}\n{%- set ns = namespace(last_user_idx = -1) %}\n{%- for m in loop_messages %}\n {%- if m[\"role\"] == \"user\" %}\n {%- set ns.last_user_idx = loop.index0 %}\n {%- endif %}\n{%- endfor %}\n{%- if system_message is defined %}\n {{- \"<|im_start|>system\\n\" + system_message }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- \"<|im_start|>system\\n\" }}\n {%- endif %}\n{%- endif %}\n{%- if tools is iterable and tools | length > 0 %}\n {%- if system_message is defined and system_message | length > 0 %}\n {{- \"\\n\\n\" }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n\" }}\n {{- \"<tools>\" }}\n {%- for tool in tools %}\n {%- if tool.function is defined %}\n {%- set tool = tool.function %}\n {%- endif %}\n {{- \"\\n<function>\\n<name>\" ~ tool.name ~ \"</name>\" }}\n {%- if tool.description is defined %}\n {{- '\\n<description>' ~ (tool.description | trim) ~ '</description>' }}\n {%- endif %}\n {{- '\\n<parameters>' }}\n {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}\n {%- for param_name, param_fields in tool.parameters.properties|items %}\n {{- '\\n<parameter>' }}\n {{- '\\n<name>' ~ param_name ~ '</name>' }}\n {%- if param_fields.type is defined %}\n {{- '\\n<type>' ~ (param_fields.type | string) ~ '</type>' }}\n {%- endif %}\n {%- if param_fields.description is defined %}\n {{- '\\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}\n {%- endif %}\n {%- if param_fields.enum is defined %}\n {{- '\\n<enum>' ~ (param_fields.enum | tojson | safe) ~ '</enum>' }}\n {%- endif %}\n {%- set handled_keys = ['name', 'type', 'description', 'enum'] %}\n {{- render_extra_keys(param_fields, handled_keys) }}\n {{- '\\n</parameter>' }}\n {%- endfor %}\n {%- endif %}\n {% set handled_keys = ['type', 'properties', 'required'] %}\n {{- render_extra_keys(tool.parameters, handled_keys) }}\n {%- if tool.parameters is defined and tool.parameters.required is defined %}\n {{- '\\n<required>' ~ (tool.parameters.required | tojson | safe) ~ '</required>' }}\n {%- endif %}\n {{- '\\n</parameters>' }}\n {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}\n {{- render_extra_keys(tool, handled_keys) }}\n {{- '\\n</function>' }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n{%- endif %}\n\n\n{%- if system_message is defined %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n\n{%- for message in loop_messages %}\n {%- if message.role == \"assistant\" %}\n {# Add reasoning content in to content field for unified processing below. #}\n {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}\n {%- set content = \"<think>\\n\" ~ message.reasoning_content ~ \"\\n</think>\\n\" ~ (message.content | default('', true)) %}\n {%- else %}\n {%- set content = message.content | default('', true) %}\n {%- if content is string -%}\n {# Allow downstream logic to to take care of broken thought, only handle coherent reasoning here. #}\n {%- if '<think>' not in content and '</think>' not in content -%}\n {%- set content = \"<think></think>\" ~ content -%}\n {%- endif -%}\n {%- else -%}\n {%- set content = content -%}\n {%- endif -%}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}\n {# Assistant message has tool calls. #}\n {{- '<|im_start|>assistant\\n' }}\n {%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}\n {%- if content is string and content | trim | length > 0 %}\n {%- if include_content %}\n {{- (content | trim) ~ '\\n' -}}\n {%- else %}\n {%- set c = (content | string) %}\n {%- if '</think>' in c %}\n {# Keep only content after the last closing think. Also generation prompt causes this. #}\n {%- set c = c.split('</think>')[-1] %}\n {%- elif '<think>' in c %}\n {# If <think> was opened but never closed, drop the trailing think segment #}\n {%- set c = c.split('<think>')[0] %}\n {%- endif %}\n {%- set c = \"<think></think>\" ~ c | trim %}\n {%- if c | length > 0 %}\n {{- c ~ '\\n' -}}\n {%- endif %}\n {%- endif %}\n {%- else %}\n {{- \"<think></think>\" -}}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n<function=' ~ tool_call.name ~ '>\\n' -}}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' ~ args_name ~ '>\\n' -}}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value ~ '\\n</parameter>\\n' -}}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>\\n' -}}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- else %}\n {# Assistant message doesn't have tool calls. #}\n {%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}\n {{- '<|im_start|>assistant\\n' ~ (content | default('', true) | string | trim) ~ '<|im_end|>\\n' }}\n {%- else %}\n {%- set c = (content | default('', true) | string) %}\n {%- if '<think>' in c and '</think>' in c %}\n {%- set c = \"<think></think>\" ~ c.split('</think>')[-1] %}\n {%- endif %}\n {%- set c = c | trim %}\n {%- if c | length > 0 %}\n {{- '<|im_start|>assistant\\n' ~ c ~ '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>assistant\\n<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n {%- endif %}\n {%- elif message.role == \"user\" or message.role == \"system\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- set content = message.content | string %}\n {{- content }}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user\\n' }}\n {%- endif %}\n {{- '<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>\\n' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endfor %}\n\n{%- if add_generation_prompt %}\n {%- if enable_thinking %}\n {{- '<|im_start|>assistant\\n<think>\\n' }}\n {%- else %}\n {{- '<|im_start|>assistant\\n<think></think>' }}\n {%- endif %}\n{%- endif %}\n"
|
| 8019 |
-
}
|
|
|
|
| 8004 |
"special": true
|
| 8005 |
}
|
| 8006 |
},
|
| 8007 |
+
"auto_map": {
|
| 8008 |
+
"AutoProcessor": "processing.NemotronH_Nano_Omni_Reasoning_V3Processor"
|
| 8009 |
+
},
|
| 8010 |
"bos_token": "<s>",
|
| 8011 |
"clean_up_tokenization_spaces": false,
|
| 8012 |
"eos_token": "<|im_end|>",
|
|
|
|
| 8016 |
"attention_mask"
|
| 8017 |
],
|
| 8018 |
"model_max_length": 262144,
|
| 8019 |
+
"pad_token": "<SPECIAL_999>",
|
| 8020 |
+
"padding_side": "left",
|
| 8021 |
+
"processor_class": "NemotronH_Nano_Omni_Reasoning_V3Processor",
|
| 8022 |
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 8023 |
"unk_token": "<unk>",
|
| 8024 |
+
"chat_template": "{% macro render_extra_keys(json_dict, handled_keys) %}\n {%- if json_dict is mapping %}\n {%- for json_key in json_dict if json_key not in handled_keys %}\n {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}\n {{- '\\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson ) ~ '</' ~ json_key ~ '>' }}\n {%- else %}\n {{- '\\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n{%- endmacro -%}\n{%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}\n{%- set reasoning_budget = reasoning_budget if reasoning_budget is defined else None %}\n{%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}\n\n{#- Scan messages for VLM thinking toggles to override enable_thinking -#}\n{%- set toggle = namespace(enable=enable_thinking) %}\n{%- for m in messages %}\n {%- if m['role'] == 'user' or m['role'] == 'system' -%}\n {%- if m['content'] is string -%}\n {%- set c = m['content'] %}\n {%- if '/think' in c.replace('</think>', '') -%}\n {%- set toggle.enable = true -%}\n {%- elif '/no_think' in c -%}\n {%- set toggle.enable = false -%}\n {%- endif -%}\n {%- else -%}\n {%- for part in m['content'] -%}\n {%- if part['type'] == 'text' -%}\n {%- set c = part['text'] %}\n {%- if '/think' in c.replace('</think>', '') -%}\n {%- set toggle.enable = true -%}\n {%- elif '/no_think' in c -%}\n {%- set toggle.enable = false -%}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n{#- Prepare message iteration similar to LM template -#}\n{%- set ns = namespace(last_user_idx = -1) %}\n{%- set loop_messages = messages %}\n{%- for m in loop_messages %}\n {%- if m[\"role\"] == \"user\" %}\n {%- set ns.last_user_idx = loop.index0 %}\n {%- endif %}\n{%- endfor -%}\n\n{%- if messages[0][\"role\"] == \"system\" %}\n {%- set system_message = messages[0][\"content\"] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n {%- set loop_messages = messages %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = [] %}\n{%- endif %}\n{#- Recompute last_user_idx relative to loop_messages after handling system -#}\n{%- set ns = namespace(last_user_idx = -1) %}\n{%- for m in loop_messages %}\n {%- if m[\"role\"] == \"user\" %}\n {%- set ns.last_user_idx = loop.index0 %}\n {%- endif %}\n{%- endfor -%}\n{#- System preamble with LM formatting, sanitize thinking toggles -#}\n{%- if system_message is defined %}\n {%- set sys_content = system_message | string %}\n {%- set sys_content = sys_content.replace('</think>', '<_end_think>').replace('/think', '').replace('/no_think', '').replace('<_end_think>', '</think>') %}\n {{- \"<|im_start|>system\\n\" + sys_content }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- \"<|im_start|>system\\n\" }}\n {%- endif %}\n{%- endif %}\n{%- if tools is iterable and tools | length > 0 %}\n {%- if system_message is defined and system_message | length > 0 %}\n {{- \"\\n\\n\" }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n\" }}\n {{- \"<tools>\" }}\n {%- for tool in tools %}\n {%- if tool.function is defined %}\n {%- set tool = tool.function %}\n {%- endif %}\n {{- \"\\n<function>\\n<name>\" ~ tool.name ~ \"</name>\" }}\n {%- if tool.description is defined %}\n {{- '\\n<description>' ~ (tool.description | trim) ~ '</description>' }}\n {%- endif %}\n {{- '\\n<parameters>' }}\n {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}\n {%- for param_name, param_fields in tool.parameters.properties|items %}\n {{- '\\n<parameter>' }}\n {{- '\\n<name>' ~ param_name ~ '</name>' }}\n {%- if param_fields.type is defined %}\n {{- '\\n<type>' ~ (param_fields.type | string) ~ '</type>' }}\n {%- endif %}\n {%- if param_fields.description is defined %}\n {{- '\\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}\n {%- endif %}\n {%- if param_fields.enum is defined %}\n {{- '\\n<enum>' ~ (param_fields.enum | tojson ) ~ '</enum>' }}\n {%- endif %}\n {%- set handled_keys = ['name', 'type', 'description', 'enum'] %}\n {{- render_extra_keys(param_fields, handled_keys) }}\n {{- '\\n</parameter>' }}\n {%- endfor %}\n {%- endif %}\n {%- set handled_keys = ['type', 'properties', 'required'] %}\n {{- render_extra_keys(tool.parameters, handled_keys) }}\n {%- if tool.parameters is defined and tool.parameters.required is defined %}\n {{- '\\n<required>' ~ (tool.parameters.required | tojson ) ~ '</required>' }}\n {%- endif %}\n {{- '\\n</parameters>' }}\n {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}\n {{- render_extra_keys(tool, handled_keys) }}\n {{- '\\n</function>' }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n{%- endif -%}\n{%- if system_message is defined %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif -%}\n{#- Iterate conversation -#}\n{%- for message in loop_messages %}\n {%- if message.role == \"assistant\" %}\n {#- Use LM assistant handling -#}\n {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}\n {%- set content = \"<think>\\n\" ~ message.reasoning_content ~ \"\\n</think>\\n\" ~ (message.content | default('', true)) %}\n {%- else %}\n {%- set content = message.content | default('', true) %}\n {%- if content is string -%}\n {%- if '<think>' not in content and '</think>' not in content -%}\n {%- set content = \"<think></think>\" ~ content -%}\n {%- endif -%}\n {%- else -%}\n {%- set content = content -%}\n {%- endif -%}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}\n {{- '<|im_start|>assistant\\n' }}\n {%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}\n {%- if content is string and content | trim | length > 0 %}\n {%- if include_content %}\n {{- (content | trim) ~ '\\n' -}}\n {%- else %}\n {%- set c = (content | string) %}\n {%- if '</think>' in c %}\n {%- set c = c.split('</think>')[-1] %}\n {%- elif '<think>' in c %}\n {%- set c = c.split('<think>')[0] %}\n {%- endif %}\n {%- set c = \"<think></think>\" ~ c | trim %}\n {%- if c | length > 0 %}\n {{- c ~ '\\n' -}}\n {%- endif %}\n {%- endif %}\n {%- else %}\n {{- \"<think></think>\" -}}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n<function=' ~ tool_call.name ~ '>\\n' -}}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' ~ args_name ~ '>\\n' -}}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value ~ '\\n</parameter>\\n' -}}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>\\n' -}}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- else %}\n {%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}\n {{- '<|im_start|>assistant\\n' ~ (content | default('', true) | string | trim) ~ '<|im_end|>\\n' }}\n {%- else %}\n {%- set c = (content | default('', true) | string) %}\n {%- if '<think>' in c and '</think>' in c %}\n {%- set c = \"<think></think>\" ~ c.split('</think>')[-1] %}\n {%- endif %}\n {%- set c = c | trim %}\n {%- if c | length > 0 %}\n {{- '<|im_start|>assistant\\n' ~ c ~ '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>assistant\\n<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n {%- endif %}\n {%- elif message.role == \"user\" or message.role == \"system\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {#- Build VLM multimodal content when content is a sequence -#}\n {%- if message.content is string -%}\n {%- set content = (message.content | string) %}\n {%- else -%}\n {%- set text_ns = namespace(val='') -%}\n {%- set mm_content = '' -%}\n {%- set counters = namespace(images=0, videos=0, audios=0) -%}\n {%- for part in message['content'] -%}\n {%- if part['type'] == 'image' or part['type'] == 'image_url' -%}\n {%- set counters.images = counters.images + 1 -%}\n {%- elif part['type'] == 'video' or part['type'] == 'video_url' -%}\n {%- set counters.videos = counters.videos + 1 -%}\n {%- elif part['type'] == 'audio' or part['type'] == 'audio_url' -%}\n {%- set counters.audios = counters.audios + 1 -%}\n {%- elif part['type'] == 'text' -%}\n {%- set text_ns.val = text_ns.val + part['text'] -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if '<image>' in text_ns.val -%}\n {%- set counters.images = 0 -%}\n {%- endif -%}\n {%- if '<video>' in text_ns.val -%}\n {%- set counters.videos = 0 -%}\n {%- endif -%}\n {%- if '<so_embedding>' in text_ns.val -%}\n {%- set counters.audios = 0 -%}\n {%- endif -%}\n {%- if counters.images > 1 -%}\n {%- set image_tags = namespace(tags=[]) -%}\n {%- for i in range(counters.images) -%}\n {%- set image_tags.tags = image_tags.tags + ['<image ' + (i + 1)|string + '><image>'] -%}\n {%- endfor -%}\n {%- set mm_content = ' '.join(image_tags.tags) + '\\n' -%}\n {%- elif counters.images == 1 -%}\n {%- set mm_content = '<image>\\n' -%}\n {%- endif -%}\n {%- set mm_content = mm_content + '<video>\\n' * counters.videos -%}\n {%- set mm_content = mm_content + '<so_embedding>\\n' * counters.audios -%}\n {%- set content = mm_content + text_ns.val.lstrip('\\n') -%}\n {%- endif -%}\n {#- Sanitize thinking toggle directives from user/system content -#}\n {%- set content = content.replace('</think>', '<_end_think>').replace('/think', '').replace('/no_think', '').replace('<_end_think>', '</think>') -%}\n {%- set content = content | trim -%}\n {%- if message.role == \"user\" and loop.index0 == ns.last_user_idx and reasoning_budget is not none -%}\n {{- content + '\\n\\n{thinking token budget: ' + (reasoning_budget | string) + '}' -}}\n {%- else -%}\n {{- content -}}\n {%- endif -%}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user\\n' }}\n {%- endif %}\n {{- '<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>\\n' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endfor -%}\n{#- Generation prompt using computed thinking toggle -#}\n{%- if add_generation_prompt %}\n {%- if toggle.enable %}\n {{- '<|im_start|>assistant\\n<think>\\n' }}\n {%- else %}\n {{- '<|im_start|>assistant\\n<think></think>' }}\n {%- endif %}\n{%- endif %}"
|
| 8025 |
+
}
|