Image-Text-to-Text
Transformers
Safetensors
English
minicpmv4_7
text-generation-inference
unsloth
conversational
Run this model with HF Jobs
Run OpenTensorLab/MiniCPM-V-4.7-1B-Signature on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenTensorLab/MiniCPM-V-4.7-1B-Signature with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenTensorLab/MiniCPM-V-4.7-1B-Signature with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenTensorLab/MiniCPM-V-4.7-1B-Signature") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenTensorLab/MiniCPM-V-4.7-1B-Signature") model = AutoModelForMultimodalLM.from_pretrained("OpenTensorLab/MiniCPM-V-4.7-1B-Signature", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenTensorLab/MiniCPM-V-4.7-1B-Signature with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenTensorLab/MiniCPM-V-4.7-1B-Signature" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/MiniCPM-V-4.7-1B-Signature", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature
- SGLang
How to use OpenTensorLab/MiniCPM-V-4.7-1B-Signature with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenTensorLab/MiniCPM-V-4.7-1B-Signature" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/MiniCPM-V-4.7-1B-Signature", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenTensorLab/MiniCPM-V-4.7-1B-Signature" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/MiniCPM-V-4.7-1B-Signature", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use OpenTensorLab/MiniCPM-V-4.7-1B-Signature with Docker Model Runner:
docker model run hf.co/OpenTensorLab/MiniCPM-V-4.7-1B-Signature
Vishva R commited on
Upload folder using huggingface_hub
Browse filesFiles changed (8)
- .gitattributes+1
- chat_template.jinjaAdded+142
- config.jsonAdded+114
- generation_config.jsonAdded+10
- model.safetensorsAdded+3
- processor_config.jsonAdded+59
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+449
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142{%- macro render_content(content, is_system_content=false) -%} {%- if content is string -%} {{- content -}} {%- elif content is iterable and content is not mapping -%} {%- set ns = namespace(parts=[]) -%} {%- for item in content -%} {%- if 'image' in item or 'image_url' in item or item.type == 'image' -%} {%- if is_system_content -%} {{- raise_exception('System message cannot contain images.') -}} {%- endif -%} {%- set ns.parts = ns.parts + ['<|image_pad|>'] -%} {%- elif 'video' in item or item.type == 'video' -%} {%- if is_system_content -%} {{- raise_exception('System message cannot contain videos.') -}} {%- endif -%} {%- set ns.parts = ns.parts + ['<|video_pad|>'] -%} {%- elif 'text' in item -%} {%- set ns.parts = ns.parts + [item.text] -%} {%- else -%} {{- raise_exception('Unexpected item type in content.') -}} {%- endif -%} {%- endfor -%} {{- ns.parts | join('\n') -}} {%- elif content is none or content is undefined -%} {{- '' -}} {%- else -%} {{- raise_exception('Unexpected content type.') -}} {%- endif -%}{%- endmacro -%}{%- if not messages %} {{- raise_exception('No messages provided.') }}{%- endif %}{%- if tools and tools is iterable and tools is not mapping %} {{- '<|im_start|>system\n' }} {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>" }} {{- '\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>' }} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, true)|trim %} {%- if content %} {{- '\n\n' + content }} {%- endif %} {%- endif %} {{- '<|im_end|>\n' }}{%- else %} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, true)|trim %} {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }} {%- endif %}{%- endif %}{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}{%- for message in messages[::-1] %} {%- set index = (messages|length - 1) - loop.index0 %} {%- if ns.multi_step_tool and message.role == "user" %} {%- set content = render_content(message.content)|trim %} {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %} {%- set ns.multi_step_tool = false %} {%- set ns.last_query_index = index %} {%- endif %} {%- endif %}{%- endfor %}{%- if ns.multi_step_tool %} {{- raise_exception('No user query found in messages.') }}{%- endif %}{%- for message in messages %} {%- set content = render_content(message.content)|trim %} {%- if message.role == "system" %} {%- if not loop.first %} {{- raise_exception('System message must be at the beginning.') }} {%- endif %} {%- elif message.role == "user" %} {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {%- set reasoning_content = '' %} {%- if message.reasoning_content is string %} {%- set reasoning_content = message.reasoning_content %} {%- else %} {%- if '</think>' in content %} {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} {%- set content = content.split('</think>')[-1].lstrip('\n') %} {%- endif %} {%- endif %} {%- set reasoning_content = reasoning_content|trim %} {%- if loop.index0 > ns.last_query_index and reasoning_content %} {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }} {%- else %} {{- '<|im_start|>' + message.role + '\n<think>\n\n</think>\n\n' + content }} {%- endif %} {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {%- if loop.first %} {%- if content|trim %} {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- else %} {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- endif %} {%- else %} {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- endif %} {%- if tool_call.arguments is defined %} {%- for args_name, args_value in tool_call.arguments|items %} {{- '<parameter=' + args_name + '>\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 %} {{- args_value }} {{- '\n</parameter>\n' }} {%- endfor %} {%- endif %} {{- '</function>\n</tool_call>' }} {%- endfor %} {%- endif %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if loop.previtem and loop.previtem.role != "tool" %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- content }} {{- '\n</tool_response>' }} {%- if not loop.last and loop.nextitem.role != "tool" %} {{- '<|im_end|>\n' }} {%- elif loop.last %} {{- '<|im_end|>\n' }} {%- endif %} {%- else %} {{- raise_exception('Unexpected message role.') }} {%- endif %}{%- endfor %}{%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- if enable_thinking is defined and enable_thinking is true %} {{- '<think>\n' }} {%- else %} {{- '<think>\n\n</think>\n\n' }} {%- endif %}{%- endif %}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114{ "architectures": [ "MiniCPMV4_7ForConditionalGeneration" ], "downsample_mode": "16x", "torch_dtype": "bfloat16", "image_end_id": 248079, "image_size": 448, "image_start_id": 248078, "image_token_id": 248056, "insert_layer_id": 6, "merge_kernel_size": [ 2, 2 ], "merger_times": 1, "model_type": "minicpmv4_7", "mrope_mode": "canvas", "newline_id": 198, "patch_size": 14, "slice_end_id": 248089, "slice_start_id": 248088, "text_config": { "attention_bias": false, "attention_dropout": 0.0, "attn_output_gate": true, "bos_token_id": null, "eos_token_id": null, "full_attention_interval": 4, "head_dim": 256, "hidden_act": "silu", "hidden_size": 1024, "initializer_range": 0.02, "intermediate_size": 3584, "layer_types": [ "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention" ], "linear_conv_kernel_dim": 4, "linear_key_head_dim": 128, "linear_num_key_heads": 16, "linear_num_value_heads": 16, "linear_value_head_dim": 128, "mamba_ssm_dtype": "float32", "max_position_embeddings": 262144, "mlp_only_layers": [], "model_type": "qwen3_5_text", "mtp_num_hidden_layers": 1, "mtp_use_dedicated_embeddings": false, "num_attention_heads": 8, "num_hidden_layers": 24, "num_key_value_heads": 2, "pad_token_id": null, "rms_norm_eps": 1e-06, "rope_parameters": { "mrope_interleaved": true, "mrope_section": [ 11, 11, 10 ], "partial_rotary_factor": 0.25, "rope_theta": 10000000, "rope_type": "default" }, "tie_word_embeddings": false, "use_cache": true, "vocab_size": 248094 }, "tie_word_embeddings": false, "transformers_version": "5.24.0", "version": 4.7, "video_token_id": 248057, "vision_config": { "attention_dropout": 0.0, "hidden_act": "gelu_pytorch_tanh", "hidden_size": 1152, "image_size": 980, "insert_layer_id": 6, "intermediate_size": 4304, "layer_norm_eps": 1e-06, "model_type": "minicpmv4_7_vision", "num_attention_heads": 16, "num_channels": 3, "num_hidden_layers": 27, "patch_size": 14, "window_kernel_size": [ 2, 2 ] }}12345678910{ "bos_token_id": 248045, "eos_token_id": [ 248044, 248046 ], "pad_token_id": 248044, "transformers_version": "5.24.0", "use_cache": true}123version https://git-lfs.github.com/spec/v1oid sha256:0de8c5889f285da5d6caa720ea115d26a0d6c019a60d491bae1466eb08299aaesize 31090544801234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859{ "image_processor": { "do_convert_rgb": true, "do_normalize": true, "do_rescale": true, "do_resize": true, "downsample_mode": "16x", "image_mean": [ 0.5, 0.5, 0.5 ], "image_processor_type": "MiniCPMV4_6ImageProcessor", "image_std": [ 0.5, 0.5, 0.5 ], "max_slice_nums": 9, "mrope_mode": "canvas", "patch_size": 14, "resample": 3, "rescale_factor": 0.00392156862745098, "scale_resolution": 448, "slice_mode": true, "use_image_id": true }, "processor_class": "MiniCPMV4_7Processor", "video_processor": { "do_convert_rgb": true, "do_normalize": true, "do_rescale": true, "do_resize": true, "do_sample_frames": true, "downsample_mode": "16x", "image_mean": [ 0.5, 0.5, 0.5 ], "image_std": [ 0.5, 0.5, 0.5 ], "max_num_frames": 128, "max_slice_nums": 9, "mrope_mode": "canvas", "patch_size": 14, "resample": 3, "rescale_factor": 0.00392156862745098, "return_metadata": false, "scale_resolution": 448, "slice_mode": true, "stack_frames": 1, "use_image_id": true, "video_processor_type": "MiniCPMV4_6VideoProcessor" }}123version https://git-lfs.github.com/spec/v1oid sha256:83fd10d1ff5d0bf7bd4e0dea788bcee2e9f56a29cb341f9b0ec352e5d8e1ece3size 19992463123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449{ "add_prefix_space": false, "audio_bos_token": "<|audio_start|>", "audio_eos_token": "<|audio_end|>", "audio_token": "<|audio_pad|>", "backend": "tokenizers", "bos_token": "<|im_start|>", "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "image_end_token": "</image>", "image_id_end_token": "</image_id>", "image_id_start_token": "<image_id>", "image_start_token": "<image>", "image_token": "<|image_pad|>", "is_local": true, "local_files_only": false, "model_max_length": 262144, "model_specific_special_tokens": { "audio_bos_token": "<|audio_start|>", "audio_eos_token": "<|audio_end|>", "audio_token": "<|audio_pad|>", "image_end_token": "</image>", "image_id_end_token": "</image_id>", "image_id_start_token": "<image_id>", "image_start_token": "<image>", "image_token": "<|image_pad|>", "slice_end_token": "</slice>", "slice_start_token": "<slice>", "video_token": "<|video_pad|>", "vision_bos_token": "<|vision_start|>", "vision_eos_token": "<|vision_end|>" }, "pad_token": "<|endoftext|>", "padding_side": "left", "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+", "processor_class": "MiniCPMV4_7Processor", "slice_end_token": "</slice>", "slice_start_token": "<slice>", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": "<unk>", "video_token": "<|video_pad|>", "vision_bos_token": "<|vision_start|>", "vision_eos_token": "<|vision_end|>", "added_tokens_decoder": { "248044": { "content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248045": { "content": "<|im_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248046": { "content": "<|im_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248047": { "content": "<|object_ref_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248048": { "content": "<|object_ref_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248049": { "content": "<|box_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248050": { "content": "<|box_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248051": { "content": "<|quad_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248052": { "content": "<|quad_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248053": { "content": "<|vision_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248054": { "content": "<|vision_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248055": { "content": "<|vision_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248056": { "content": "<|image_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248057": { "content": "<|video_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248058": { "content": "<tool_call>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248059": { "content": "</tool_call>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248060": { "content": "<|fim_prefix|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248061": { "content": "<|fim_middle|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248062": { "content": "<|fim_suffix|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248063": { "content": "<|fim_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248064": { "content": "<|repo_name|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248065": { "content": "<|file_sep|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248066": { "content": "<tool_response>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248067": { "content": "</tool_response>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248068": { "content": "<think>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248069": { "content": "</think>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": false }, "248070": { "content": "<|audio_start|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248071": { "content": "<|audio_end|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248072": { "content": "<tts_pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248073": { "content": "<tts_text_bos>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248074": { "content": "<tts_text_eod>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248075": { "content": "<tts_text_bos_single>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248076": { "content": "<|audio_pad|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248077": { "content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248078": { "content": "<image>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248079": { "content": "</image>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248080": { "content": "<ref>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248081": { "content": "</ref>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248082": { "content": "<box>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248083": { "content": "</box>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248084": { "content": "<quad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248085": { "content": "</quad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248086": { "content": "<point>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248087": { "content": "</point>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248088": { "content": "<slice>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248089": { "content": "</slice>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248090": { "content": "<image_id>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248091": { "content": "</image_id>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248092": { "content": "<timestamp>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "248093": { "content": "</timestamp>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true } }, "chat_template": "{%- macro render_content(content, is_system_content=false) -%}\n {%- if content is string -%}\n {{- content -}}\n {%- elif content is iterable and content is not mapping -%}\n {%- set ns = namespace(parts=[]) -%}\n {%- for item in content -%}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' -%}\n {%- if is_system_content -%}\n {{- raise_exception('System message cannot contain images.') -}}\n {%- endif -%}\n {%- set ns.parts = ns.parts + ['<|image_pad|>'] -%}\n {%- elif 'video' in item or item.type == 'video' -%}\n {%- if is_system_content -%}\n {{- raise_exception('System message cannot contain videos.') -}}\n {%- endif -%}\n {%- set ns.parts = ns.parts + ['<|video_pad|>'] -%}\n {%- elif 'text' in item -%}\n {%- set ns.parts = ns.parts + [item.text] -%}\n {%- else -%}\n {{- raise_exception('Unexpected item type in content.') -}}\n {%- endif -%}\n {%- endfor -%}\n {{- ns.parts | join('\\n') -}}\n {%- elif content is none or content is undefined -%}\n {{- '' -}}\n {%- else -%}\n {{- raise_exception('Unexpected content type.') -}}\n {%- endif -%}\n{%- endmacro -%}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\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 {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, true)|trim %}\n {%- if content %}\n {{- '\\n\\n' + content }}\n {%- endif %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, true)|trim %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {{- raise_exception('No user query found in messages.') }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = render_content(message.content)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if loop.index0 > ns.last_query_index and reasoning_content %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n\\n</think>\\n\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\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 {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\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 {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\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 {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\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 {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is true %}\n {{- '<think>\\n' }}\n {%- else %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}\n"}.gitattributes+1
chat_template.jinjaAdded+142
config.jsonAdded+114
generation_config.jsonAdded+10
model.safetensorsAdded+3
processor_config.jsonAdded+59
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+449