Image-Text-to-Text
Transformers
Safetensors
kimi_k3
feature-extraction
compressed-tensors
unsloth
conversational
custom_code
Eval Results
8-bit precision
Instructions to use unsloth/Kimi-K3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Kimi-K3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/Kimi-K3", trust_remote_code=True) 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)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("unsloth/Kimi-K3", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Kimi-K3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Kimi-K3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Kimi-K3", "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/unsloth/Kimi-K3
- SGLang
How to use unsloth/Kimi-K3 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 "unsloth/Kimi-K3" \ --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": "unsloth/Kimi-K3", "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 "unsloth/Kimi-K3" \ --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": "unsloth/Kimi-K3", "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 Studio
How to use unsloth/Kimi-K3 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/Kimi-K3 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/Kimi-K3 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/Kimi-K3 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="unsloth/Kimi-K3", max_seq_length=2048, ) - Docker Model Runner
How to use unsloth/Kimi-K3 with Docker Model Runner:
docker model run hf.co/unsloth/Kimi-K3
Upload folder using huggingface_hub
Browse files- .eval_results/apex-agents.yaml +7 -0
- .eval_results/deep-swe.yaml +7 -0
- .eval_results/gpqa.yaml +7 -0
- .eval_results/hle.yaml +7 -0
- .gitattributes +1 -0
- README.md +22 -4
- __pycache__/encoding_k3.cpython-313.pyc +0 -0
- added_tokens.json +9 -0
- chat_template.jinja +191 -0
- config.json +67 -29
- processor_config.json +45 -0
- tokenizer_config.json +87 -16
.eval_results/apex-agents.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: mercor/apex-agents
|
| 3 |
+
task_id: apex-agents
|
| 4 |
+
value: 41
|
| 5 |
+
source:
|
| 6 |
+
url: https://huggingface.co/moonshotai/Kimi-K3
|
| 7 |
+
name: Model Card
|
.eval_results/deep-swe.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: datacurve/deep-swe
|
| 3 |
+
task_id: deep_swe
|
| 4 |
+
value: 67.5
|
| 5 |
+
source:
|
| 6 |
+
url: https://huggingface.co/moonshotai/Kimi-K3
|
| 7 |
+
name: Model Card
|
.eval_results/gpqa.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: Idavidrein/gpqa
|
| 3 |
+
task_id: diamond
|
| 4 |
+
value: 93.5
|
| 5 |
+
source:
|
| 6 |
+
url: https://huggingface.co/moonshotai/Kimi-K3
|
| 7 |
+
name: Model Card
|
.eval_results/hle.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: cais/hle
|
| 3 |
+
task_id: hle
|
| 4 |
+
value: 56
|
| 5 |
+
source:
|
| 6 |
+
url: https://huggingface.co/moonshotai/Kimi-K3
|
| 7 |
+
name: Model Card
|
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* 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 |
model.safetensors.index.json 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 |
model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/k3-hero.jpg filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,14 +1,32 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
- compressed-tensors
|
|
|
|
| 4 |
- conversational
|
| 5 |
license: other
|
| 6 |
-
license_name: kimi-k3
|
| 7 |
library_name: transformers
|
| 8 |
pipeline_tag: image-text-to-text
|
| 9 |
-
base_model:
|
| 10 |
-
- moonshotai/Kimi-K3
|
| 11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
<div align="center">
|
| 13 |
<picture>
|
| 14 |
<img src="assets/kimi-logo.png" width="30%" alt="Kimi K3">
|
|
@@ -679,4 +697,4 @@ Both the code repository and the model weights are released under the [Kimi K3 L
|
|
| 679 |
|
| 680 |
## 8. Contact Us
|
| 681 |
|
| 682 |
-
If you have any questions, please reach out at [[email protected]](mailto:[email protected]).
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- moonshotai/Kimi-K3
|
| 4 |
tags:
|
| 5 |
- compressed-tensors
|
| 6 |
+
- unsloth
|
| 7 |
- conversational
|
| 8 |
license: other
|
| 9 |
+
license_name: "kimi-k3"
|
| 10 |
library_name: transformers
|
| 11 |
pipeline_tag: image-text-to-text
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
+
<div>
|
| 14 |
+
<p style="margin-top: 0;margin-bottom: 0;">
|
| 15 |
+
<em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>
|
| 16 |
+
</p>
|
| 17 |
+
<div style="display: flex; gap: 5px; align-items: center; ">
|
| 18 |
+
<a href="https://github.com/unslothai/unsloth/">
|
| 19 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
| 20 |
+
</a>
|
| 21 |
+
<a href="https://discord.gg/unsloth">
|
| 22 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 23 |
+
</a>
|
| 24 |
+
<a href="https://docs.unsloth.ai/">
|
| 25 |
+
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 26 |
+
</a>
|
| 27 |
+
</div>
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
<div align="center">
|
| 31 |
<picture>
|
| 32 |
<img src="assets/kimi-logo.png" width="30%" alt="Kimi K3">
|
|
|
|
| 697 |
|
| 698 |
## 8. Contact Us
|
| 699 |
|
| 700 |
+
If you have any questions, please reach out at [[email protected]](mailto:[email protected]).
|
__pycache__/encoding_k3.cpython-313.pyc
ADDED
|
Binary file (27.5 kB). View file
|
|
|
added_tokens.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<|end_header_id|>": 163844,
|
| 3 |
+
"<|im_assistant|>": 163842,
|
| 4 |
+
"<|im_end|>": 163840,
|
| 5 |
+
"<|im_middle|>": 163846,
|
| 6 |
+
"<|im_system|>": 163845,
|
| 7 |
+
"<|im_user|>": 163841,
|
| 8 |
+
"<|start_header_id|>": 163843
|
| 9 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#- Kimi-K3 XTML chat template. -#}
|
| 2 |
+
{#- Faithful Jinja port of encoding_k3.build_chat_segments() from the moonshotai/Kimi-K3 -#}
|
| 3 |
+
{#- repo, which ships no chat_template of its own (rendering lives in Python there). -#}
|
| 4 |
+
{#- Structural markers <|open|> / <|close|> / <|sep|> / <|end_of_msg|> are special tokens; -#}
|
| 5 |
+
{#- tag names, attributes and bodies are ordinary text. -#}
|
| 6 |
+
{#- -#}
|
| 7 |
+
{#- Verified char-for-char against build_chat_segments() on 16 fixtures covering chat, -#}
|
| 8 |
+
{#- thinking, images, tool declaration, tool calls and results, tool_choice and both -#}
|
| 9 |
+
{#- response_format modes. Two cosmetic JSON differences remain inside tool schema blobs: -#}
|
| 10 |
+
{#- key order follows the caller instead of deep_sort_dict(), and separators are ", " / ": " -#}
|
| 11 |
+
{#- rather than compact. Neither changes the structure of the rendered JSON. -#}
|
| 12 |
+
{%- macro attr(k, v) -%}
|
| 13 |
+
{{ ' ' }}{{ k }}{{ '="' }}{{ v | string | replace('&', '&') | replace('"', '"') }}{{ '"' }}
|
| 14 |
+
{%- endmacro -%}
|
| 15 |
+
{%- macro otag(tag) -%}{{ '<|open|>' }}{{ tag }}{{ '<|sep|>' }}{%- endmacro -%}
|
| 16 |
+
{%- macro ctag(tag) -%}{{ '<|close|>' }}{{ tag }}{{ '<|sep|>' }}{%- endmacro -%}
|
| 17 |
+
{%- macro content(c) -%}
|
| 18 |
+
{%- if c is string -%}
|
| 19 |
+
{{ c }}
|
| 20 |
+
{%- elif c is not none and c is not mapping and c is iterable -%}
|
| 21 |
+
{%- for part in c -%}
|
| 22 |
+
{%- if part['type'] == 'image' or part['type'] == 'image_url' -%}
|
| 23 |
+
{{ '<|kimi_image_placeholder|>' }}
|
| 24 |
+
{%- else -%}
|
| 25 |
+
{{ part['text'] }}
|
| 26 |
+
{%- endif -%}
|
| 27 |
+
{%- endfor -%}
|
| 28 |
+
{%- endif -%}
|
| 29 |
+
{%- endmacro -%}
|
| 30 |
+
{%- macro xtype(v) -%}
|
| 31 |
+
{%- if v is boolean -%}boolean
|
| 32 |
+
{%- elif v is none -%}null
|
| 33 |
+
{%- elif v is number -%}number
|
| 34 |
+
{%- elif v is string -%}string
|
| 35 |
+
{%- elif v is mapping -%}object
|
| 36 |
+
{%- else -%}array
|
| 37 |
+
{%- endif -%}
|
| 38 |
+
{%- endmacro -%}
|
| 39 |
+
{%- macro xvalue(v) -%}
|
| 40 |
+
{%- if v is string -%}{{ v }}{%- else -%}{{ v | tojson }}{%- endif -%}
|
| 41 |
+
{%- endmacro -%}
|
| 42 |
+
{#- ------------------------------------------------------------------------------------- -#}
|
| 43 |
+
{%- if not add_generation_prompt is defined -%}
|
| 44 |
+
{%- set add_generation_prompt = false -%}
|
| 45 |
+
{%- endif -%}
|
| 46 |
+
{%- if not thinking is defined -%}
|
| 47 |
+
{%- if enable_thinking is defined -%}
|
| 48 |
+
{%- set thinking = enable_thinking -%}
|
| 49 |
+
{%- else -%}
|
| 50 |
+
{%- set thinking = true -%}
|
| 51 |
+
{%- endif -%}
|
| 52 |
+
{%- endif -%}
|
| 53 |
+
{%- if not thinking_effort is defined -%}
|
| 54 |
+
{#- tokenization_kimi.apply_chat_template does kwargs.setdefault("thinking_effort", "max") -#}
|
| 55 |
+
{%- set thinking_effort = 'max' -%}
|
| 56 |
+
{%- endif -%}
|
| 57 |
+
{#- Tool declaration, emitted once ahead of the conversation. -#}
|
| 58 |
+
{%- if tools is defined and tools -%}
|
| 59 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-declare') }}{{ '<|sep|>' }}
|
| 60 |
+
{{- '# Tools\nHere are the available tools, described in JSONSchema.\n\n```json\n' }}
|
| 61 |
+
{{- tools | tojson }}{{ '\n```' }}
|
| 62 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 63 |
+
{%- endif -%}
|
| 64 |
+
{%- if thinking and (thinking_effort == 'low' or thinking_effort == 'high' or thinking_effort == 'max') -%}
|
| 65 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'thinking-effort') }}{{ '<|sep|>' }}
|
| 66 |
+
{{- '`thinking_effort` guides on how much to think in your thinking channel (not including the response channel), supported values include `low`, `medium`, `high`, and `max`.\nNow the system is invoked with `thinking_effort=' }}
|
| 67 |
+
{{- thinking_effort }}{{ '`.' }}
|
| 68 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 69 |
+
{%- endif -%}
|
| 70 |
+
{#- ------------------------------------------------------------------------------------- -#}
|
| 71 |
+
{%- set ns = namespace(tool_calls = none, tool_index = 0) -%}
|
| 72 |
+
{%- for message in messages -%}
|
| 73 |
+
{%- set role = message['role'] -%}
|
| 74 |
+
{%- if role == 'user' -%}
|
| 75 |
+
{{- '<|open|>message' }}{{ attr('role', 'user') }}
|
| 76 |
+
{%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}
|
| 77 |
+
{{- '<|sep|>' }}{{ content(message['content']) }}
|
| 78 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 79 |
+
{%- elif role == 'system' and message['tools'] is defined and message['tools'] -%}
|
| 80 |
+
{#- A system message carrying tools is a dynamic (lazy-loaded) tool declaration. -#}
|
| 81 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-declare') }}{{ '<|sep|>' }}
|
| 82 |
+
{{- '## New Tools Available\nThe system dynamically extends the toolset via lazy-loading.\nYou have access to all existing and extended tools.\nHere are the specs for the extended tools.\n\n```json\n' }}
|
| 83 |
+
{{- message['tools'] | tojson }}{{ '\n```' }}
|
| 84 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 85 |
+
{%- elif role == 'system' -%}
|
| 86 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}
|
| 87 |
+
{%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}
|
| 88 |
+
{{- '<|sep|>' }}{{ content(message['content']) }}
|
| 89 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 90 |
+
{%- elif role == 'tool' -%}
|
| 91 |
+
{%- set ns.tool_index = ns.tool_index + 1 -%}
|
| 92 |
+
{%- set tool_name = none -%}
|
| 93 |
+
{%- if message['tool'] is defined and message['tool'] -%}
|
| 94 |
+
{%- set tool_name = message['tool'] -%}
|
| 95 |
+
{%- elif message['name'] is defined and message['name'] -%}
|
| 96 |
+
{%- set tool_name = message['name'] -%}
|
| 97 |
+
{%- elif ns.tool_calls and ns.tool_index <= (ns.tool_calls | length) -%}
|
| 98 |
+
{%- set tc = ns.tool_calls[ns.tool_index - 1] -%}
|
| 99 |
+
{%- if tc['function'] is defined and tc['function'] -%}
|
| 100 |
+
{%- set tool_name = tc['function']['name'] -%}
|
| 101 |
+
{%- else -%}
|
| 102 |
+
{%- set tool_name = tc['name'] -%}
|
| 103 |
+
{%- endif -%}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{{- '<|open|>message' }}{{ attr('role', 'tool') }}{{ attr('tool', tool_name) }}{{ attr('index', ns.tool_index) }}{{ '<|sep|>' }}
|
| 106 |
+
{{- content(message['content']) }}
|
| 107 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 108 |
+
{%- elif role == 'assistant' -%}
|
| 109 |
+
{%- if message['tool_calls'] is defined and message['tool_calls'] -%}
|
| 110 |
+
{%- set ns.tool_calls = message['tool_calls'] -%}
|
| 111 |
+
{%- else -%}
|
| 112 |
+
{%- set ns.tool_calls = none -%}
|
| 113 |
+
{%- endif -%}
|
| 114 |
+
{%- set ns.tool_index = 0 -%}
|
| 115 |
+
{{- '<|open|>message' }}{{ attr('role', 'assistant') }}
|
| 116 |
+
{%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}
|
| 117 |
+
{{- '<|sep|>' }}
|
| 118 |
+
{#- The <think> channel is structural: in thinking mode it is always emitted, even
|
| 119 |
+
empty. In non-thinking mode it is dropped entirely. -#}
|
| 120 |
+
{%- if thinking -%}
|
| 121 |
+
{{- otag('think') }}
|
| 122 |
+
{%- if message['reasoning_content'] is defined and message['reasoning_content'] -%}
|
| 123 |
+
{{- message['reasoning_content'] }}
|
| 124 |
+
{%- elif message['reasoning'] is defined and message['reasoning'] -%}
|
| 125 |
+
{{- message['reasoning'] }}
|
| 126 |
+
{%- endif -%}
|
| 127 |
+
{{- ctag('think') }}
|
| 128 |
+
{%- endif -%}
|
| 129 |
+
{{- otag('response') }}{{ content(message['content']) }}{{ ctag('response') }}
|
| 130 |
+
{%- if message['tool_calls'] is defined and message['tool_calls'] -%}
|
| 131 |
+
{{- otag('tools') }}
|
| 132 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 133 |
+
{%- set fn = tool_call['function'] if (tool_call['function'] is defined and tool_call['function']) else tool_call -%}
|
| 134 |
+
{{- '<|open|>call' }}{{ attr('tool', fn['name']) }}{{ attr('index', loop.index) }}{{ '<|sep|>' }}
|
| 135 |
+
{%- set args = fn['arguments'] if fn['arguments'] is defined else none -%}
|
| 136 |
+
{%- if args is string -%}
|
| 137 |
+
{#- Arguments that could not be decoded into an object are passed through
|
| 138 |
+
verbatim inside a json block, matching _xtml_json_block. llama.cpp
|
| 139 |
+
decodes JSON-string arguments into objects before rendering, so this
|
| 140 |
+
path is only reached for genuinely non-JSON payloads. -#}
|
| 141 |
+
{{- '<|open|>json' }}{{ attr('type', 'object') }}{{ '<|sep|>' }}
|
| 142 |
+
{{- args }}
|
| 143 |
+
{{- ctag('json') }}
|
| 144 |
+
{%- elif args is mapping -%}
|
| 145 |
+
{%- for key, val in args.items() -%}
|
| 146 |
+
{{- '<|open|>argument' }}{{ attr('key', key) }}{{ attr('type', xtype(val)) }}{{ '<|sep|>' }}
|
| 147 |
+
{{- xvalue(val) }}
|
| 148 |
+
{{- ctag('argument') }}
|
| 149 |
+
{%- endfor -%}
|
| 150 |
+
{%- endif -%}
|
| 151 |
+
{{- ctag('call') }}
|
| 152 |
+
{%- endfor -%}
|
| 153 |
+
{{- ctag('tools') }}
|
| 154 |
+
{%- endif -%}
|
| 155 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 156 |
+
{%- endif -%}
|
| 157 |
+
{%- endfor -%}
|
| 158 |
+
{#- ------------------------------------------------------------------------------------- -#}
|
| 159 |
+
{%- if tool_choice is defined and tool_choice == 'required' -%}
|
| 160 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-choice') }}{{ '<|sep|>' }}
|
| 161 |
+
{{- 'The system is invoked with `tool_choice=required`.\nYou MUST call tools in the next message.' }}
|
| 162 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 163 |
+
{%- elif tool_choice is defined and tool_choice == 'none' -%}
|
| 164 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-choice') }}{{ '<|sep|>' }}
|
| 165 |
+
{{- 'The system is invoked with `tool_choice=none`.\nYou MUST NOT call any tools in the next message.' }}
|
| 166 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 167 |
+
{%- endif -%}
|
| 168 |
+
{%- if response_format is defined and response_format -%}
|
| 169 |
+
{%- set rf_type = response_format['type'] if (response_format is mapping and response_format['type'] is defined) else response_format -%}
|
| 170 |
+
{%- if rf_type == 'json_object' -%}
|
| 171 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'response-format') }}{{ '<|sep|>' }}
|
| 172 |
+
{{- 'The system is invoked with `response_format=json_object`.\nYour response must be raw JSON data without markdown code blocks (```json) or any additional formatting.' }}
|
| 173 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 174 |
+
{%- elif rf_type == 'json_schema' -%}
|
| 175 |
+
{%- set schema = none -%}
|
| 176 |
+
{%- if response_schema is defined and response_schema -%}
|
| 177 |
+
{%- set schema = response_schema -%}
|
| 178 |
+
{%- elif response_format['json_schema'] is defined and response_format['json_schema'] -%}
|
| 179 |
+
{%- set js = response_format['json_schema'] -%}
|
| 180 |
+
{%- set schema = js['schema'] if (js is mapping and js['schema'] is defined) else js -%}
|
| 181 |
+
{%- endif -%}
|
| 182 |
+
{{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'response-format') }}{{ '<|sep|>' }}
|
| 183 |
+
{{- 'The system is invoked with `response_format=json_schema`.\nYour response must be raw JSON data without markdown code blocks (```json) or any additional formatting.\nThe JSON data must match the following schema:\n```json\n' }}
|
| 184 |
+
{{- schema | tojson }}{{ '\n```' }}
|
| 185 |
+
{{- ctag('message') }}{{ '<|end_of_msg|>' }}
|
| 186 |
+
{%- endif -%}
|
| 187 |
+
{%- endif -%}
|
| 188 |
+
{%- if add_generation_prompt -%}
|
| 189 |
+
{{- '<|open|>message' }}{{ attr('role', 'assistant') }}{{ '<|sep|>' }}
|
| 190 |
+
{%- if thinking -%}{{- otag('think') }}{%- else -%}{{- otag('response') }}{%- endif -%}
|
| 191 |
+
{%- endif -%}
|
config.json
CHANGED
|
@@ -8,13 +8,52 @@
|
|
| 8 |
"AutoModelForCausalLM": "modeling_kimi_k3.KimiK3ForConditionalGeneration"
|
| 9 |
},
|
| 10 |
"bos_token_id": 163584,
|
| 11 |
-
"
|
| 12 |
"eos_token_id": 163586,
|
| 13 |
"ignore_index": -100,
|
| 14 |
"image_placeholder": "<|kimi_image_placeholder|>",
|
| 15 |
"media_placeholder_token_id": 163605,
|
| 16 |
"model_type": "kimi_k3",
|
| 17 |
"pad_token_id": 163839,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"text_config": {
|
| 19 |
"_name_or_path": "",
|
| 20 |
"activation_situ_beta": 4.0,
|
|
@@ -29,23 +68,15 @@
|
|
| 29 |
"AutoModel": "modeling_kimi_linear.KimiLinearModel",
|
| 30 |
"AutoModelForCausalLM": "modeling_kimi_linear.KimiLinearForCausalLM"
|
| 31 |
},
|
| 32 |
-
"bad_words_ids": null,
|
| 33 |
-
"begin_suppress_tokens": null,
|
| 34 |
"bos_token_id": 163584,
|
| 35 |
"chunk_size_feed_forward": 0,
|
| 36 |
"cross_attention_hidden_size": null,
|
| 37 |
"decoder_start_token_id": null,
|
| 38 |
-
"
|
| 39 |
-
"do_sample": false,
|
| 40 |
-
"dtype": "bfloat16",
|
| 41 |
-
"early_stopping": false,
|
| 42 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 43 |
"eos_token_id": 163586,
|
| 44 |
-
"exponential_decay_length_penalty": null,
|
| 45 |
"finetuning_task": null,
|
| 46 |
"first_k_dense_replace": 1,
|
| 47 |
-
"
|
| 48 |
-
"forced_eos_token_id": null,
|
| 49 |
"hidden_act": "situ",
|
| 50 |
"hidden_size": 7168,
|
| 51 |
"id2label": {
|
|
@@ -62,7 +93,6 @@
|
|
| 62 |
"LABEL_1": 1
|
| 63 |
},
|
| 64 |
"latent_moe_use_norm": true,
|
| 65 |
-
"length_penalty": 1.0,
|
| 66 |
"linear_attn_config": {
|
| 67 |
"full_attn_layers": [
|
| 68 |
4,
|
|
@@ -167,9 +197,7 @@
|
|
| 167 |
"short_conv_kernel_size": 4,
|
| 168 |
"use_full_rank_gate": true
|
| 169 |
},
|
| 170 |
-
"max_length": 20,
|
| 171 |
"max_position_embeddings": 1048576,
|
| 172 |
-
"min_length": 0,
|
| 173 |
"mla_use_nope": true,
|
| 174 |
"mla_use_output_gate": true,
|
| 175 |
"model_type": "kimi_linear",
|
|
@@ -177,21 +205,16 @@
|
|
| 177 |
"moe_layer_freq": 1,
|
| 178 |
"moe_renormalize": true,
|
| 179 |
"moe_router_activation_func": "sigmoid",
|
| 180 |
-
"no_repeat_ngram_size": 0,
|
| 181 |
"num_attention_heads": 96,
|
| 182 |
-
"num_beam_groups": 1,
|
| 183 |
-
"num_beams": 1,
|
| 184 |
"num_expert_group": 1,
|
| 185 |
"num_experts": 896,
|
| 186 |
"num_experts_per_token": 16,
|
| 187 |
"num_hidden_layers": 93,
|
| 188 |
"num_key_value_heads": 96,
|
| 189 |
"num_nextn_predict_layers": 0,
|
| 190 |
-
"num_return_sequences": 1,
|
| 191 |
"num_shared_experts": 2,
|
| 192 |
"output_attentions": false,
|
| 193 |
"output_hidden_states": false,
|
| 194 |
-
"output_scores": false,
|
| 195 |
"pad_token_id": 163839,
|
| 196 |
"prefix": null,
|
| 197 |
"problem_type": null,
|
|
@@ -238,28 +261,24 @@
|
|
| 238 |
"quant_method": "compressed-tensors",
|
| 239 |
"quantization_status": "compressed"
|
| 240 |
},
|
| 241 |
-
"remove_invalid_values": false,
|
| 242 |
-
"repetition_penalty": 1.0,
|
| 243 |
"return_dict": true,
|
| 244 |
-
"return_dict_in_generate": false,
|
| 245 |
"rms_norm_eps": 1e-05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
"routed_expert_hidden_size": 3584,
|
| 247 |
"routed_scaling_factor": 1.0,
|
| 248 |
"sep_token_id": null,
|
| 249 |
-
"suppress_tokens": null,
|
| 250 |
"task_specific_params": null,
|
| 251 |
-
"temperature": 1.0,
|
| 252 |
"tf_legacy_loss": false,
|
| 253 |
"tie_encoder_decoder": false,
|
| 254 |
"tie_word_embeddings": false,
|
| 255 |
"tokenizer_class": null,
|
| 256 |
-
"top_k": 50,
|
| 257 |
-
"top_p": 1.0,
|
| 258 |
"topk_group": 1,
|
| 259 |
"topk_method": "noaux_tc",
|
| 260 |
"torchscript": false,
|
| 261 |
-
"transformers_version": "4.56.2",
|
| 262 |
-
"typical_p": 1.0,
|
| 263 |
"use_bfloat16": false,
|
| 264 |
"use_cache": true,
|
| 265 |
"use_grouped_topk": true,
|
|
@@ -267,13 +286,27 @@
|
|
| 267 |
"vocab_size": 163840
|
| 268 |
},
|
| 269 |
"tie_word_embeddings": false,
|
|
|
|
|
|
|
| 270 |
"vision_config": {
|
| 271 |
-
"
|
| 272 |
"activation_func": "gelu_pytorch_tanh",
|
|
|
|
| 273 |
"attn_bias": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
"init_pos_emb_height": 64,
|
| 275 |
"init_pos_emb_time": 4,
|
| 276 |
"init_pos_emb_width": 64,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
"linear_bias": false,
|
| 278 |
"merge_kernel_size": [
|
| 279 |
2,
|
|
@@ -283,14 +316,19 @@
|
|
| 283 |
"mlp_type": "mlp2",
|
| 284 |
"mm_hidden_size": 1024,
|
| 285 |
"mm_projector_type": "patchmergerv2",
|
|
|
|
| 286 |
"norm_type": "rmsnorm",
|
|
|
|
|
|
|
| 287 |
"patch_embed_proj_bias": false,
|
| 288 |
"patch_size": 14,
|
| 289 |
"pos_emb_interpolation_mode": "bilinear",
|
| 290 |
"pos_emb_type": "divided_fixed",
|
|
|
|
| 291 |
"projector_hidden_act": "gelu",
|
| 292 |
"projector_ln_eps": 1e-05,
|
| 293 |
"qkv_hidden_size": 1536,
|
|
|
|
| 294 |
"text_hidden_size": 7168,
|
| 295 |
"vt_hidden_size": 1024,
|
| 296 |
"vt_intermediate_size": 4096,
|
|
|
|
| 8 |
"AutoModelForCausalLM": "modeling_kimi_k3.KimiK3ForConditionalGeneration"
|
| 9 |
},
|
| 10 |
"bos_token_id": 163584,
|
| 11 |
+
"torch_dtype": "bfloat16",
|
| 12 |
"eos_token_id": 163586,
|
| 13 |
"ignore_index": -100,
|
| 14 |
"image_placeholder": "<|kimi_image_placeholder|>",
|
| 15 |
"media_placeholder_token_id": 163605,
|
| 16 |
"model_type": "kimi_k3",
|
| 17 |
"pad_token_id": 163839,
|
| 18 |
+
"quantization_config": {
|
| 19 |
+
"config_groups": {
|
| 20 |
+
"group_0": {
|
| 21 |
+
"format": "mxfp4-pack-quantized",
|
| 22 |
+
"input_activations": null,
|
| 23 |
+
"output_activations": null,
|
| 24 |
+
"targets": [
|
| 25 |
+
"Linear"
|
| 26 |
+
],
|
| 27 |
+
"weights": {
|
| 28 |
+
"actorder": null,
|
| 29 |
+
"block_structure": null,
|
| 30 |
+
"dynamic": false,
|
| 31 |
+
"group_size": 32,
|
| 32 |
+
"num_bits": 4,
|
| 33 |
+
"observer": "minmax",
|
| 34 |
+
"observer_kwargs": {},
|
| 35 |
+
"scale_dtype": "torch.uint8",
|
| 36 |
+
"strategy": "group",
|
| 37 |
+
"symmetric": true,
|
| 38 |
+
"type": "float",
|
| 39 |
+
"zp_dtype": null
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
},
|
| 43 |
+
"format": "mxfp4-pack-quantized",
|
| 44 |
+
"global_compression_ratio": null,
|
| 45 |
+
"ignore": [
|
| 46 |
+
"re:.*self_attn.*",
|
| 47 |
+
"re:.*shared_experts.*",
|
| 48 |
+
"re:.*mlp\\.(gate|up|gate_up|down)_proj.*",
|
| 49 |
+
"re:.*lm_head.*",
|
| 50 |
+
"re:.*vision_tower.*",
|
| 51 |
+
"re:.*mm_projector.*"
|
| 52 |
+
],
|
| 53 |
+
"kv_cache_scheme": null,
|
| 54 |
+
"quant_method": "compressed-tensors",
|
| 55 |
+
"quantization_status": "compressed"
|
| 56 |
+
},
|
| 57 |
"text_config": {
|
| 58 |
"_name_or_path": "",
|
| 59 |
"activation_situ_beta": 4.0,
|
|
|
|
| 68 |
"AutoModel": "modeling_kimi_linear.KimiLinearModel",
|
| 69 |
"AutoModelForCausalLM": "modeling_kimi_linear.KimiLinearForCausalLM"
|
| 70 |
},
|
|
|
|
|
|
|
| 71 |
"bos_token_id": 163584,
|
| 72 |
"chunk_size_feed_forward": 0,
|
| 73 |
"cross_attention_hidden_size": null,
|
| 74 |
"decoder_start_token_id": null,
|
| 75 |
+
"torch_dtype": "bfloat16",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
"eos_token_id": 163586,
|
|
|
|
| 77 |
"finetuning_task": null,
|
| 78 |
"first_k_dense_replace": 1,
|
| 79 |
+
"head_dim": 74,
|
|
|
|
| 80 |
"hidden_act": "situ",
|
| 81 |
"hidden_size": 7168,
|
| 82 |
"id2label": {
|
|
|
|
| 93 |
"LABEL_1": 1
|
| 94 |
},
|
| 95 |
"latent_moe_use_norm": true,
|
|
|
|
| 96 |
"linear_attn_config": {
|
| 97 |
"full_attn_layers": [
|
| 98 |
4,
|
|
|
|
| 197 |
"short_conv_kernel_size": 4,
|
| 198 |
"use_full_rank_gate": true
|
| 199 |
},
|
|
|
|
| 200 |
"max_position_embeddings": 1048576,
|
|
|
|
| 201 |
"mla_use_nope": true,
|
| 202 |
"mla_use_output_gate": true,
|
| 203 |
"model_type": "kimi_linear",
|
|
|
|
| 205 |
"moe_layer_freq": 1,
|
| 206 |
"moe_renormalize": true,
|
| 207 |
"moe_router_activation_func": "sigmoid",
|
|
|
|
| 208 |
"num_attention_heads": 96,
|
|
|
|
|
|
|
| 209 |
"num_expert_group": 1,
|
| 210 |
"num_experts": 896,
|
| 211 |
"num_experts_per_token": 16,
|
| 212 |
"num_hidden_layers": 93,
|
| 213 |
"num_key_value_heads": 96,
|
| 214 |
"num_nextn_predict_layers": 0,
|
|
|
|
| 215 |
"num_shared_experts": 2,
|
| 216 |
"output_attentions": false,
|
| 217 |
"output_hidden_states": false,
|
|
|
|
| 218 |
"pad_token_id": 163839,
|
| 219 |
"prefix": null,
|
| 220 |
"problem_type": null,
|
|
|
|
| 261 |
"quant_method": "compressed-tensors",
|
| 262 |
"quantization_status": "compressed"
|
| 263 |
},
|
|
|
|
|
|
|
| 264 |
"return_dict": true,
|
|
|
|
| 265 |
"rms_norm_eps": 1e-05,
|
| 266 |
+
"rope_parameters": {
|
| 267 |
+
"rope_theta": 10000.0,
|
| 268 |
+
"rope_type": "default"
|
| 269 |
+
},
|
| 270 |
+
"rope_theta": 10000.0,
|
| 271 |
"routed_expert_hidden_size": 3584,
|
| 272 |
"routed_scaling_factor": 1.0,
|
| 273 |
"sep_token_id": null,
|
|
|
|
| 274 |
"task_specific_params": null,
|
|
|
|
| 275 |
"tf_legacy_loss": false,
|
| 276 |
"tie_encoder_decoder": false,
|
| 277 |
"tie_word_embeddings": false,
|
| 278 |
"tokenizer_class": null,
|
|
|
|
|
|
|
| 279 |
"topk_group": 1,
|
| 280 |
"topk_method": "noaux_tc",
|
| 281 |
"torchscript": false,
|
|
|
|
|
|
|
| 282 |
"use_bfloat16": false,
|
| 283 |
"use_cache": true,
|
| 284 |
"use_grouped_topk": true,
|
|
|
|
| 286 |
"vocab_size": 163840
|
| 287 |
},
|
| 288 |
"tie_word_embeddings": false,
|
| 289 |
+
"transformers_version": "5.15.0.dev0",
|
| 290 |
+
"unsloth_fixed": true,
|
| 291 |
"vision_config": {
|
| 292 |
+
"_name_or_path": "",
|
| 293 |
"activation_func": "gelu_pytorch_tanh",
|
| 294 |
+
"architectures": null,
|
| 295 |
"attn_bias": false,
|
| 296 |
+
"chunk_size_feed_forward": 0,
|
| 297 |
+
"torch_dtype": null,
|
| 298 |
+
"id2label": {
|
| 299 |
+
"0": "LABEL_0",
|
| 300 |
+
"1": "LABEL_1"
|
| 301 |
+
},
|
| 302 |
"init_pos_emb_height": 64,
|
| 303 |
"init_pos_emb_time": 4,
|
| 304 |
"init_pos_emb_width": 64,
|
| 305 |
+
"is_encoder_decoder": false,
|
| 306 |
+
"label2id": {
|
| 307 |
+
"LABEL_0": 0,
|
| 308 |
+
"LABEL_1": 1
|
| 309 |
+
},
|
| 310 |
"linear_bias": false,
|
| 311 |
"merge_kernel_size": [
|
| 312 |
2,
|
|
|
|
| 316 |
"mlp_type": "mlp2",
|
| 317 |
"mm_hidden_size": 1024,
|
| 318 |
"mm_projector_type": "patchmergerv2",
|
| 319 |
+
"model_type": "",
|
| 320 |
"norm_type": "rmsnorm",
|
| 321 |
+
"output_attentions": false,
|
| 322 |
+
"output_hidden_states": false,
|
| 323 |
"patch_embed_proj_bias": false,
|
| 324 |
"patch_size": 14,
|
| 325 |
"pos_emb_interpolation_mode": "bilinear",
|
| 326 |
"pos_emb_type": "divided_fixed",
|
| 327 |
+
"problem_type": null,
|
| 328 |
"projector_hidden_act": "gelu",
|
| 329 |
"projector_ln_eps": 1e-05,
|
| 330 |
"qkv_hidden_size": 1536,
|
| 331 |
+
"return_dict": true,
|
| 332 |
"text_hidden_size": 7168,
|
| 333 |
"vt_hidden_size": 1024,
|
| 334 |
"vt_intermediate_size": 4096,
|
processor_config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "kimi_k3_processor.KimiK3Processor"
|
| 4 |
+
},
|
| 5 |
+
"image_processor": {
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoImageProcessor": "kimi_k3_vision_processing.KimiK3VisionProcessor",
|
| 8 |
+
"AutoProcessor": "kimi_k3_processor.KimiK3Processor"
|
| 9 |
+
},
|
| 10 |
+
"image_processor_type": "KimiK3VisionProcessor",
|
| 11 |
+
"media_proc_cfg": {
|
| 12 |
+
"config_type": "media_proc.processors.moonvit.MoonViTMediaProcessorConfig",
|
| 13 |
+
"fixed_output_tokens": null,
|
| 14 |
+
"image_mean": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"image_std": [
|
| 20 |
+
0.5,
|
| 21 |
+
0.5,
|
| 22 |
+
0.5
|
| 23 |
+
],
|
| 24 |
+
"in_patch_limit": 65536,
|
| 25 |
+
"in_patch_limit_each_frame": 16384,
|
| 26 |
+
"in_patch_limit_video": 655360,
|
| 27 |
+
"max_num_frames_each_video": null,
|
| 28 |
+
"merge_kernel_size": 2,
|
| 29 |
+
"patch_limit_on_one_side": 512,
|
| 30 |
+
"patch_size": 14,
|
| 31 |
+
"sample_fps": 8.0,
|
| 32 |
+
"temporal_merge_kernel_size": 4,
|
| 33 |
+
"timestamp_mode": "hh:mm:ss.fff",
|
| 34 |
+
"transparent_bg_config": {
|
| 35 |
+
"chessboard_gray_value": 180,
|
| 36 |
+
"chessboard_square_on_top_left": true,
|
| 37 |
+
"chessboard_square_size": 8,
|
| 38 |
+
"chessboard_white_value": 255,
|
| 39 |
+
"pattern": "chessboard"
|
| 40 |
+
},
|
| 41 |
+
"transparent_bg_fill_stage": "after_resize"
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"processor_class": "KimiK3Processor"
|
| 45 |
+
}
|
tokenizer_config.json
CHANGED
|
@@ -127,31 +127,102 @@
|
|
| 127 |
"rstrip": false,
|
| 128 |
"single_word": false,
|
| 129 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
}
|
| 131 |
},
|
| 132 |
"additional_special_tokens": [
|
| 133 |
-
"<|
|
| 134 |
-
"
|
| 135 |
-
"
|
|
|
|
|
|
|
| 136 |
"[EOT]",
|
| 137 |
-
"<|
|
| 138 |
-
"<|
|
| 139 |
-
"<|media_end|>",
|
| 140 |
-
"<|media_pad|>",
|
| 141 |
-
"<osagent_mode>"
|
| 142 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
"bos_token": "[BOS]",
|
| 144 |
"clean_up_tokenization_spaces": false,
|
| 145 |
"eos_token": "[EOS]",
|
| 146 |
-
"extra_special_tokens":
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
"pad_token": "[PAD]",
|
|
|
|
|
|
|
| 149 |
"tokenizer_class": "TikTokenTokenizer",
|
| 150 |
"unk_token": "[UNK]",
|
| 151 |
-
"auto_map": {
|
| 152 |
-
"AutoTokenizer": [
|
| 153 |
-
"tokenization_kimi.TikTokenTokenizer",
|
| 154 |
-
null
|
| 155 |
-
]
|
| 156 |
-
}
|
| 157 |
}
|
|
|
|
| 127 |
"rstrip": false,
|
| 128 |
"single_word": false,
|
| 129 |
"special": true
|
| 130 |
+
},
|
| 131 |
+
"163840": {
|
| 132 |
+
"content": "<|im_end|>",
|
| 133 |
+
"lstrip": false,
|
| 134 |
+
"normalized": false,
|
| 135 |
+
"rstrip": false,
|
| 136 |
+
"single_word": false,
|
| 137 |
+
"special": true
|
| 138 |
+
},
|
| 139 |
+
"163841": {
|
| 140 |
+
"content": "<|im_user|>",
|
| 141 |
+
"lstrip": false,
|
| 142 |
+
"normalized": false,
|
| 143 |
+
"rstrip": false,
|
| 144 |
+
"single_word": false,
|
| 145 |
+
"special": true
|
| 146 |
+
},
|
| 147 |
+
"163842": {
|
| 148 |
+
"content": "<|im_assistant|>",
|
| 149 |
+
"lstrip": false,
|
| 150 |
+
"normalized": false,
|
| 151 |
+
"rstrip": false,
|
| 152 |
+
"single_word": false,
|
| 153 |
+
"special": true
|
| 154 |
+
},
|
| 155 |
+
"163843": {
|
| 156 |
+
"content": "<|start_header_id|>",
|
| 157 |
+
"lstrip": false,
|
| 158 |
+
"normalized": false,
|
| 159 |
+
"rstrip": false,
|
| 160 |
+
"single_word": false,
|
| 161 |
+
"special": true
|
| 162 |
+
},
|
| 163 |
+
"163844": {
|
| 164 |
+
"content": "<|end_header_id|>",
|
| 165 |
+
"lstrip": false,
|
| 166 |
+
"normalized": false,
|
| 167 |
+
"rstrip": false,
|
| 168 |
+
"single_word": false,
|
| 169 |
+
"special": true
|
| 170 |
+
},
|
| 171 |
+
"163845": {
|
| 172 |
+
"content": "<|im_system|>",
|
| 173 |
+
"lstrip": false,
|
| 174 |
+
"normalized": false,
|
| 175 |
+
"rstrip": false,
|
| 176 |
+
"single_word": false,
|
| 177 |
+
"special": true
|
| 178 |
+
},
|
| 179 |
+
"163846": {
|
| 180 |
+
"content": "<|im_middle|>",
|
| 181 |
+
"lstrip": false,
|
| 182 |
+
"normalized": false,
|
| 183 |
+
"rstrip": false,
|
| 184 |
+
"single_word": false,
|
| 185 |
+
"special": true
|
| 186 |
}
|
| 187 |
},
|
| 188 |
"additional_special_tokens": [
|
| 189 |
+
"<|im_end|>",
|
| 190 |
+
"<|im_user|>",
|
| 191 |
+
"<|im_assistant|>",
|
| 192 |
+
"<|start_header_id|>",
|
| 193 |
+
"<|end_header_id|>",
|
| 194 |
"[EOT]",
|
| 195 |
+
"<|im_system|>",
|
| 196 |
+
"<|im_middle|>"
|
|
|
|
|
|
|
|
|
|
| 197 |
],
|
| 198 |
+
"auto_map": {
|
| 199 |
+
"AutoProcessor": "kimi_k3_processor.KimiK3Processor",
|
| 200 |
+
"AutoTokenizer": [
|
| 201 |
+
"tokenization_kimi.TikTokenTokenizer",
|
| 202 |
+
null
|
| 203 |
+
]
|
| 204 |
+
},
|
| 205 |
+
"backend": "custom",
|
| 206 |
"bos_token": "[BOS]",
|
| 207 |
"clean_up_tokenization_spaces": false,
|
| 208 |
"eos_token": "[EOS]",
|
| 209 |
+
"extra_special_tokens": [
|
| 210 |
+
"<|im_end|>",
|
| 211 |
+
"<|im_user|>",
|
| 212 |
+
"<|im_assistant|>",
|
| 213 |
+
"<|start_header_id|>",
|
| 214 |
+
"<|end_header_id|>",
|
| 215 |
+
"[EOT]",
|
| 216 |
+
"<|im_system|>",
|
| 217 |
+
"<|im_middle|>"
|
| 218 |
+
],
|
| 219 |
+
"is_local": true,
|
| 220 |
+
"local_files_only": false,
|
| 221 |
+
"model_max_length": 1048576,
|
| 222 |
"pad_token": "[PAD]",
|
| 223 |
+
"padding_side": "left",
|
| 224 |
+
"processor_class": "KimiK3Processor",
|
| 225 |
"tokenizer_class": "TikTokenTokenizer",
|
| 226 |
"unk_token": "[UNK]",
|
| 227 |
+
"chat_template": "{#- Kimi-K3 XTML chat template. -#}\n{#- Faithful Jinja port of encoding_k3.build_chat_segments() from the moonshotai/Kimi-K3 -#}\n{#- repo, which ships no chat_template of its own (rendering lives in Python there). -#}\n{#- Structural markers <|open|> / <|close|> / <|sep|> / <|end_of_msg|> are special tokens; -#}\n{#- tag names, attributes and bodies are ordinary text. -#}\n{#- -#}\n{#- Verified char-for-char against build_chat_segments() on 16 fixtures covering chat, -#}\n{#- thinking, images, tool declaration, tool calls and results, tool_choice and both -#}\n{#- response_format modes. Two cosmetic JSON differences remain inside tool schema blobs: -#}\n{#- key order follows the caller instead of deep_sort_dict(), and separators are \", \" / \": \" -#}\n{#- rather than compact. Neither changes the structure of the rendered JSON. -#}\n{%- macro attr(k, v) -%}\n{{ ' ' }}{{ k }}{{ '=\"' }}{{ v | string | replace('&', '&') | replace('\"', '"') }}{{ '\"' }}\n{%- endmacro -%}\n{%- macro otag(tag) -%}{{ '<|open|>' }}{{ tag }}{{ '<|sep|>' }}{%- endmacro -%}\n{%- macro ctag(tag) -%}{{ '<|close|>' }}{{ tag }}{{ '<|sep|>' }}{%- endmacro -%}\n{%- macro content(c) -%}\n {%- if c is string -%}\n {{ c }}\n {%- elif c is not none and c is not mapping and c is iterable -%}\n {%- for part in c -%}\n {%- if part['type'] == 'image' or part['type'] == 'image_url' -%}\n {{ '<|kimi_image_placeholder|>' }}\n {%- else -%}\n {{ part['text'] }}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n{%- endmacro -%}\n{%- macro xtype(v) -%}\n {%- if v is boolean -%}boolean\n {%- elif v is none -%}null\n {%- elif v is number -%}number\n {%- elif v is string -%}string\n {%- elif v is mapping -%}object\n {%- else -%}array\n {%- endif -%}\n{%- endmacro -%}\n{%- macro xvalue(v) -%}\n {%- if v is string -%}{{ v }}{%- else -%}{{ v | tojson }}{%- endif -%}\n{%- endmacro -%}\n{#- ------------------------------------------------------------------------------------- -#}\n{%- if not add_generation_prompt is defined -%}\n {%- set add_generation_prompt = false -%}\n{%- endif -%}\n{%- if not thinking is defined -%}\n {%- if enable_thinking is defined -%}\n {%- set thinking = enable_thinking -%}\n {%- else -%}\n {%- set thinking = true -%}\n {%- endif -%}\n{%- endif -%}\n{%- if not thinking_effort is defined -%}\n {#- tokenization_kimi.apply_chat_template does kwargs.setdefault(\"thinking_effort\", \"max\") -#}\n {%- set thinking_effort = 'max' -%}\n{%- endif -%}\n{#- Tool declaration, emitted once ahead of the conversation. -#}\n{%- if tools is defined and tools -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-declare') }}{{ '<|sep|>' }}\n {{- '# Tools\\nHere are the available tools, described in JSONSchema.\\n\\n```json\\n' }}\n {{- tools | tojson }}{{ '\\n```' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n{%- endif -%}\n{%- if thinking and (thinking_effort == 'low' or thinking_effort == 'high' or thinking_effort == 'max') -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'thinking-effort') }}{{ '<|sep|>' }}\n {{- '`thinking_effort` guides on how much to think in your thinking channel (not including the response channel), supported values include `low`, `medium`, `high`, and `max`.\\nNow the system is invoked with `thinking_effort=' }}\n {{- thinking_effort }}{{ '`.' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n{%- endif -%}\n{#- ------------------------------------------------------------------------------------- -#}\n{%- set ns = namespace(tool_calls = none, tool_index = 0) -%}\n{%- for message in messages -%}\n {%- set role = message['role'] -%}\n {%- if role == 'user' -%}\n {{- '<|open|>message' }}{{ attr('role', 'user') }}\n {%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}\n {{- '<|sep|>' }}{{ content(message['content']) }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- elif role == 'system' and message['tools'] is defined and message['tools'] -%}\n {#- A system message carrying tools is a dynamic (lazy-loaded) tool declaration. -#}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-declare') }}{{ '<|sep|>' }}\n {{- '## New Tools Available\\nThe system dynamically extends the toolset via lazy-loading.\\nYou have access to all existing and extended tools.\\nHere are the specs for the extended tools.\\n\\n```json\\n' }}\n {{- message['tools'] | tojson }}{{ '\\n```' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- elif role == 'system' -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}\n {%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}\n {{- '<|sep|>' }}{{ content(message['content']) }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- elif role == 'tool' -%}\n {%- set ns.tool_index = ns.tool_index + 1 -%}\n {%- set tool_name = none -%}\n {%- if message['tool'] is defined and message['tool'] -%}\n {%- set tool_name = message['tool'] -%}\n {%- elif message['name'] is defined and message['name'] -%}\n {%- set tool_name = message['name'] -%}\n {%- elif ns.tool_calls and ns.tool_index <= (ns.tool_calls | length) -%}\n {%- set tc = ns.tool_calls[ns.tool_index - 1] -%}\n {%- if tc['function'] is defined and tc['function'] -%}\n {%- set tool_name = tc['function']['name'] -%}\n {%- else -%}\n {%- set tool_name = tc['name'] -%}\n {%- endif -%}\n {%- endif -%}\n {{- '<|open|>message' }}{{ attr('role', 'tool') }}{{ attr('tool', tool_name) }}{{ attr('index', ns.tool_index) }}{{ '<|sep|>' }}\n {{- content(message['content']) }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- elif role == 'assistant' -%}\n {%- if message['tool_calls'] is defined and message['tool_calls'] -%}\n {%- set ns.tool_calls = message['tool_calls'] -%}\n {%- else -%}\n {%- set ns.tool_calls = none -%}\n {%- endif -%}\n {%- set ns.tool_index = 0 -%}\n {{- '<|open|>message' }}{{ attr('role', 'assistant') }}\n {%- if message['name'] is defined and message['name'] -%}{{ attr('name', message['name']) }}{%- endif -%}\n {{- '<|sep|>' }}\n {#- The <think> channel is structural: in thinking mode it is always emitted, even\n empty. In non-thinking mode it is dropped entirely. -#}\n {%- if thinking -%}\n {{- otag('think') }}\n {%- if message['reasoning_content'] is defined and message['reasoning_content'] -%}\n {{- message['reasoning_content'] }}\n {%- elif message['reasoning'] is defined and message['reasoning'] -%}\n {{- message['reasoning'] }}\n {%- endif -%}\n {{- ctag('think') }}\n {%- endif -%}\n {{- otag('response') }}{{ content(message['content']) }}{{ ctag('response') }}\n {%- if message['tool_calls'] is defined and message['tool_calls'] -%}\n {{- otag('tools') }}\n {%- for tool_call in message['tool_calls'] -%}\n {%- set fn = tool_call['function'] if (tool_call['function'] is defined and tool_call['function']) else tool_call -%}\n {{- '<|open|>call' }}{{ attr('tool', fn['name']) }}{{ attr('index', loop.index) }}{{ '<|sep|>' }}\n {%- set args = fn['arguments'] if fn['arguments'] is defined else none -%}\n {%- if args is string -%}\n {#- Arguments that could not be decoded into an object are passed through\n verbatim inside a json block, matching _xtml_json_block. llama.cpp\n decodes JSON-string arguments into objects before rendering, so this\n path is only reached for genuinely non-JSON payloads. -#}\n {{- '<|open|>json' }}{{ attr('type', 'object') }}{{ '<|sep|>' }}\n {{- args }}\n {{- ctag('json') }}\n {%- elif args is mapping -%}\n {%- for key, val in args.items() -%}\n {{- '<|open|>argument' }}{{ attr('key', key) }}{{ attr('type', xtype(val)) }}{{ '<|sep|>' }}\n {{- xvalue(val) }}\n {{- ctag('argument') }}\n {%- endfor -%}\n {%- endif -%}\n {{- ctag('call') }}\n {%- endfor -%}\n {{- ctag('tools') }}\n {%- endif -%}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- endif -%}\n{%- endfor -%}\n{#- ------------------------------------------------------------------------------------- -#}\n{%- if tool_choice is defined and tool_choice == 'required' -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-choice') }}{{ '<|sep|>' }}\n {{- 'The system is invoked with `tool_choice=required`.\\nYou MUST call tools in the next message.' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n{%- elif tool_choice is defined and tool_choice == 'none' -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'tool-choice') }}{{ '<|sep|>' }}\n {{- 'The system is invoked with `tool_choice=none`.\\nYou MUST NOT call any tools in the next message.' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n{%- endif -%}\n{%- if response_format is defined and response_format -%}\n {%- set rf_type = response_format['type'] if (response_format is mapping and response_format['type'] is defined) else response_format -%}\n {%- if rf_type == 'json_object' -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'response-format') }}{{ '<|sep|>' }}\n {{- 'The system is invoked with `response_format=json_object`.\\nYour response must be raw JSON data without markdown code blocks (```json) or any additional formatting.' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- elif rf_type == 'json_schema' -%}\n {%- set schema = none -%}\n {%- if response_schema is defined and response_schema -%}\n {%- set schema = response_schema -%}\n {%- elif response_format['json_schema'] is defined and response_format['json_schema'] -%}\n {%- set js = response_format['json_schema'] -%}\n {%- set schema = js['schema'] if (js is mapping and js['schema'] is defined) else js -%}\n {%- endif -%}\n {{- '<|open|>message' }}{{ attr('role', 'system') }}{{ attr('type', 'response-format') }}{{ '<|sep|>' }}\n {{- 'The system is invoked with `response_format=json_schema`.\\nYour response must be raw JSON data without markdown code blocks (```json) or any additional formatting.\\nThe JSON data must match the following schema:\\n```json\\n' }}\n {{- schema | tojson }}{{ '\\n```' }}\n {{- ctag('message') }}{{ '<|end_of_msg|>' }}\n {%- endif -%}\n{%- endif -%}\n{%- if add_generation_prompt -%}\n {{- '<|open|>message' }}{{ attr('role', 'assistant') }}{{ '<|sep|>' }}\n {%- if thinking -%}{{- otag('think') }}{%- else -%}{{- otag('response') }}{%- endif -%}\n{%- endif -%}\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|