Instructions to use tiny-random/longcat-flash-lite-sparse with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/longcat-flash-lite-sparse with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/longcat-flash-lite-sparse") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import LongcatCausalLM model = LongcatCausalLM.from_pretrained("tiny-random/longcat-flash-lite-sparse", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/longcat-flash-lite-sparse with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/longcat-flash-lite-sparse" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/longcat-flash-lite-sparse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiny-random/longcat-flash-lite-sparse
- SGLang
How to use tiny-random/longcat-flash-lite-sparse 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 "tiny-random/longcat-flash-lite-sparse" \ --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": "tiny-random/longcat-flash-lite-sparse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "tiny-random/longcat-flash-lite-sparse" \ --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": "tiny-random/longcat-flash-lite-sparse", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiny-random/longcat-flash-lite-sparse with Docker Model Runner:
docker model run hf.co/tiny-random/longcat-flash-lite-sparse
Upload folder using huggingface_hub
Browse files- .meta/create_model.py +168 -0
- .meta/env.json +19 -0
- .meta/model.log +0 -0
- LICENSE +21 -0
- README.md +64 -0
- config.json +60 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer_config.json +42 -0
.meta/create_model.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def create_model(source_model_id: str, source_revision: str, save_folder: str) -> str:
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
from huggingface_hub import hf_hub_download
|
| 8 |
+
from safetensors.torch import save_file
|
| 9 |
+
|
| 10 |
+
folder = Path(save_folder)
|
| 11 |
+
folder.mkdir(parents=True, exist_ok=True)
|
| 12 |
+
for name in (
|
| 13 |
+
"tokenizer.json",
|
| 14 |
+
"tokenizer_config.json",
|
| 15 |
+
"special_tokens_map.json",
|
| 16 |
+
"generation_config.json",
|
| 17 |
+
"LICENSE",
|
| 18 |
+
):
|
| 19 |
+
(folder / name).write_bytes(Path(hf_hub_download(source_model_id, name, revision=source_revision)).read_bytes())
|
| 20 |
+
|
| 21 |
+
config = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
|
| 22 |
+
# Internal-only geometry; task vocabulary, token ids, attention method and all LSA/MTP schedules are fixed.
|
| 23 |
+
# LONGCAT_TINY_NUM_HEADS lets the same generator emit a TP=1 evidence variant (full 32-head attention
|
| 24 |
+
# fan-out; indexer, MoE and embedding tensors are TP-neutral and stay byte-identical).
|
| 25 |
+
# LONGCAT_TINY_NUM_LAYERS sets the logical layer count (the TP=1 indexer-topk evidence model needs
|
| 26 |
+
# 8 logical layers so its 16 physical attention sublayers match the TP=4 checkpoint's 8).
|
| 27 |
+
tiny_heads = int(os.environ.get("LONGCAT_TINY_NUM_HEADS", "8"))
|
| 28 |
+
tiny_layers = int(os.environ.get("LONGCAT_TINY_NUM_LAYERS", "4"))
|
| 29 |
+
config.update(
|
| 30 |
+
num_layers=tiny_layers,
|
| 31 |
+
hidden_size=8,
|
| 32 |
+
ffn_hidden_size=64,
|
| 33 |
+
expert_ffn_hidden_size=32,
|
| 34 |
+
num_attention_heads=tiny_heads,
|
| 35 |
+
kv_lora_rank=256,
|
| 36 |
+
q_lora_rank=32,
|
| 37 |
+
qk_nope_head_dim=64,
|
| 38 |
+
qk_rope_head_dim=64,
|
| 39 |
+
v_head_dim=128,
|
| 40 |
+
n_routed_experts=32,
|
| 41 |
+
zero_expert_num=128,
|
| 42 |
+
moe_topk=12,
|
| 43 |
+
oe_vocab_size_ratio=4,
|
| 44 |
+
oe_neighbor_num=2,
|
| 45 |
+
oe_split_num=2,
|
| 46 |
+
)
|
| 47 |
+
# LongCat has two attention sublayers per logical layer (physical ids 0..2*num_layers-1).
|
| 48 |
+
# The DSA indexer-topk capturer defaults to num_hidden_layers slots; expose the real
|
| 49 |
+
# physical attention-sublayer count so the return_indexer_topk buffer is sized correctly.
|
| 50 |
+
config["num_indexer_layers"] = 2 * config["num_layers"]
|
| 51 |
+
# The published checkpoint ships one draft layer regardless of mtp_num_layers; keep its runtime schedule field.
|
| 52 |
+
(folder / "config.json").write_text(json.dumps(config, indent=2) + "\n")
|
| 53 |
+
|
| 54 |
+
hidden = config["hidden_size"]
|
| 55 |
+
ffn = config["ffn_hidden_size"]
|
| 56 |
+
expert_ffn = config["expert_ffn_hidden_size"]
|
| 57 |
+
num_layers = config["num_layers"]
|
| 58 |
+
num_heads = config["num_attention_heads"]
|
| 59 |
+
q_lora = config["q_lora_rank"]
|
| 60 |
+
kv_lora = config["kv_lora_rank"]
|
| 61 |
+
nope = config["qk_nope_head_dim"]
|
| 62 |
+
rope = config["qk_rope_head_dim"]
|
| 63 |
+
value = config["v_head_dim"]
|
| 64 |
+
n_routed = config["n_routed_experts"]
|
| 65 |
+
n_zero = config["zero_expert_num"]
|
| 66 |
+
index_heads = config["index_n_heads"]
|
| 67 |
+
index_head_dim = config["index_head_dim"]
|
| 68 |
+
vocab = config["vocab_size"]
|
| 69 |
+
qk = nope + rope
|
| 70 |
+
|
| 71 |
+
torch.manual_seed(42)
|
| 72 |
+
|
| 73 |
+
def weight(shape, dtype=torch.bfloat16):
|
| 74 |
+
return (torch.randn(*shape) * 0.02).to(dtype).contiguous()
|
| 75 |
+
|
| 76 |
+
tensors = {}
|
| 77 |
+
tensors["model.embed_tokens.weight"] = weight((vocab, hidden))
|
| 78 |
+
tensors["lm_head.weight"] = weight((vocab, hidden))
|
| 79 |
+
tensors["model.norm.weight"] = weight((hidden,))
|
| 80 |
+
|
| 81 |
+
for layer in range(num_layers):
|
| 82 |
+
prefix = f"model.layers.{layer}"
|
| 83 |
+
for sublayer in (0, 1):
|
| 84 |
+
attn = f"{prefix}.self_attn.{sublayer}"
|
| 85 |
+
tensors[f"{attn}.q_a_proj.weight"] = weight((q_lora, hidden))
|
| 86 |
+
tensors[f"{attn}.q_a_layernorm.weight"] = weight((q_lora,))
|
| 87 |
+
tensors[f"{attn}.q_b_proj.weight"] = weight((num_heads * qk, q_lora))
|
| 88 |
+
tensors[f"{attn}.kv_a_proj_with_mqa.weight"] = weight((kv_lora + rope, hidden))
|
| 89 |
+
tensors[f"{attn}.kv_a_layernorm.weight"] = weight((kv_lora,))
|
| 90 |
+
tensors[f"{attn}.kv_b_proj.weight"] = weight((num_heads * (nope + value), kv_lora))
|
| 91 |
+
tensors[f"{attn}.o_proj.weight"] = weight((hidden, num_heads * value))
|
| 92 |
+
tensors[f"{prefix}.input_layernorm.{sublayer}.weight"] = weight((hidden,))
|
| 93 |
+
tensors[f"{prefix}.post_attention_layernorm.{sublayer}.weight"] = weight((hidden,))
|
| 94 |
+
tensors[f"{prefix}.mlps.{sublayer}.gate_proj.weight"] = weight((ffn, hidden))
|
| 95 |
+
tensors[f"{prefix}.mlps.{sublayer}.up_proj.weight"] = weight((ffn, hidden))
|
| 96 |
+
tensors[f"{prefix}.mlps.{sublayer}.down_proj.weight"] = weight((hidden, ffn))
|
| 97 |
+
# LSA indexer lives on the first attention sublayer of every logical layer (CLI factor 2).
|
| 98 |
+
indexer = f"{prefix}.self_attn.0.indexer"
|
| 99 |
+
tensors[f"{indexer}.wq_b.weight"] = weight((index_heads * index_head_dim, q_lora))
|
| 100 |
+
tensors[f"{indexer}.wk.weight"] = weight((index_head_dim, hidden))
|
| 101 |
+
tensors[f"{indexer}.weights_proj.weight"] = weight((index_heads, hidden))
|
| 102 |
+
tensors[f"{indexer}.k_norm.weight"] = weight((index_head_dim,))
|
| 103 |
+
# Routers are FP32 in the source checkpoint; identity zero experts carry no weights.
|
| 104 |
+
tensors[f"{prefix}.mlp.router.classifier.weight"] = weight((n_routed + n_zero, hidden), torch.float32)
|
| 105 |
+
tensors[f"{prefix}.mlp.router.e_score_correction_bias"] = torch.zeros((n_routed + n_zero,), dtype=torch.float32)
|
| 106 |
+
for expert in range(n_routed):
|
| 107 |
+
tensors[f"{prefix}.mlp.experts.{expert}.gate_proj.weight"] = weight((expert_ffn, hidden))
|
| 108 |
+
tensors[f"{prefix}.mlp.experts.{expert}.up_proj.weight"] = weight((expert_ffn, hidden))
|
| 109 |
+
tensors[f"{prefix}.mlp.experts.{expert}.down_proj.weight"] = weight((hidden, expert_ffn))
|
| 110 |
+
|
| 111 |
+
# Over-embeddings: two n-gram windows, modulus ratio 4 like tiny-random/longcat-flash-lite.
|
| 112 |
+
modulus = config["oe_vocab_size_ratio"] * vocab
|
| 113 |
+
over_width = hidden // (config["oe_split_num"] * (config["oe_neighbor_num"] - 1))
|
| 114 |
+
for index in range(config["oe_split_num"] * (config["oe_neighbor_num"] - 1)):
|
| 115 |
+
rows = modulus + 2 * index + 1
|
| 116 |
+
tensors[f"model.ngram_embeddings.embedders.{index}.weight"] = weight((rows, over_width))
|
| 117 |
+
tensors[f"model.ngram_embeddings.post_projs.{index}.weight"] = weight((hidden, over_width))
|
| 118 |
+
|
| 119 |
+
# One MTP/NextN draft layer: tied embedding copy, EH projection, norms, dense MLA with its own indexer.
|
| 120 |
+
tensors["model.mtp.embed_tokens.weight"] = tensors["model.embed_tokens.weight"].clone()
|
| 121 |
+
tensors["model.mtp.layers.0.eh_proj.weight"] = weight((hidden, 2 * hidden))
|
| 122 |
+
tensors["model.mtp.layers.0.enorm.m.weight"] = weight((hidden,))
|
| 123 |
+
tensors["model.mtp.layers.0.hnorm.m.weight"] = weight((hidden,))
|
| 124 |
+
tensors["model.mtp.layers.0.input_layernorm.weight"] = weight((hidden,))
|
| 125 |
+
tensors["model.mtp.layers.0.post_attention_layernorm.weight"] = weight((hidden,))
|
| 126 |
+
draft = "model.mtp.layers.0.self_attn"
|
| 127 |
+
tensors[f"{draft}.q_a_proj.weight"] = weight((q_lora, hidden))
|
| 128 |
+
tensors[f"{draft}.q_a_layernorm.weight"] = weight((q_lora,))
|
| 129 |
+
tensors[f"{draft}.q_b_proj.weight"] = weight((num_heads * qk, q_lora))
|
| 130 |
+
tensors[f"{draft}.kv_a_proj_with_mqa.weight"] = weight((kv_lora + rope, hidden))
|
| 131 |
+
tensors[f"{draft}.kv_a_layernorm.weight"] = weight((kv_lora,))
|
| 132 |
+
tensors[f"{draft}.kv_b_proj.weight"] = weight((num_heads * (nope + value), kv_lora))
|
| 133 |
+
tensors[f"{draft}.o_proj.weight"] = weight((hidden, num_heads * value))
|
| 134 |
+
tensors[f"{draft}.indexer.wq_b.weight"] = weight((index_heads * index_head_dim, q_lora))
|
| 135 |
+
tensors[f"{draft}.indexer.wk.weight"] = weight((index_head_dim, hidden))
|
| 136 |
+
tensors[f"{draft}.indexer.weights_proj.weight"] = weight((index_heads, hidden))
|
| 137 |
+
tensors[f"{draft}.indexer.k_norm.weight"] = weight((index_head_dim,))
|
| 138 |
+
tensors["model.mtp.layers.0.transformer_layer.mlp.gate_proj.weight"] = weight((ffn, hidden))
|
| 139 |
+
tensors["model.mtp.layers.0.transformer_layer.mlp.up_proj.weight"] = weight((ffn, hidden))
|
| 140 |
+
tensors["model.mtp.layers.0.transformer_layer.mlp.down_proj.weight"] = weight((hidden, ffn))
|
| 141 |
+
tensors["model.mtp.norm.weight"] = weight((hidden,))
|
| 142 |
+
|
| 143 |
+
save_file(tensors, str(folder / "model.safetensors"), metadata={"format": "pt"})
|
| 144 |
+
|
| 145 |
+
expected_prefixes = (
|
| 146 |
+
"model.embed_tokens.",
|
| 147 |
+
"model.norm.",
|
| 148 |
+
"lm_head.",
|
| 149 |
+
"model.layers.",
|
| 150 |
+
"model.ngram_embeddings.",
|
| 151 |
+
"model.mtp.",
|
| 152 |
+
)
|
| 153 |
+
assert all(name.startswith(expected_prefixes) for name in tensors)
|
| 154 |
+
assert len(tensors["model.mtp.embed_tokens.weight"].shape) == 2
|
| 155 |
+
return (
|
| 156 |
+
"LongcatCausalLM (direct SGLang-schema tiny checkpoint): 4 dual-sublayer LongCat Flash decoder "
|
| 157 |
+
"layers with shortcut MoE (32 routed + 128 identity zero experts, top-k 12), compressed MLA "
|
| 158 |
+
"(q_lora_rank=32, kv_lora_rank=32, 32 heads, nope 32 / rope 64 / value 32), LSA indexers "
|
| 159 |
+
"(16 heads, head dim 128, CLI factor 2), two over-embedding windows, one MTP/NextN draft layer, "
|
| 160 |
+
"131,072-row untied token tables."
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
create_model(
|
| 165 |
+
source_model_id="meituan-longcat/LongCat-Flash-Lite-Sparse",
|
| 166 |
+
source_revision="35de83a18b5838ec1657edb3f885a59bbdd7888f",
|
| 167 |
+
save_folder="/tmp/longcat-flash-lite-sparse",
|
| 168 |
+
)
|
.meta/env.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_model": {
|
| 3 |
+
"name": "meituan-longcat/LongCat-Flash-Lite-Sparse",
|
| 4 |
+
"commit_id": "35de83a18b5838ec1657edb3f885a59bbdd7888f"
|
| 5 |
+
},
|
| 6 |
+
"environments": {
|
| 7 |
+
"creation": {
|
| 8 |
+
"python": "3.12.13",
|
| 9 |
+
"packages": {
|
| 10 |
+
"huggingface_hub": "2.3.0",
|
| 11 |
+
"safetensors": "0.8.0",
|
| 12 |
+
"tokenizers": "0.23.3",
|
| 13 |
+
"torch": "2.13.0+cu126",
|
| 14 |
+
"transformers": "5.22.0.dev0"
|
| 15 |
+
},
|
| 16 |
+
"cuda": "12.6"
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
}
|
.meta/model.log
ADDED
|
File without changes
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Meituan
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
base_model:
|
| 5 |
+
- meituan-longcat/LongCat-Flash-Lite-Sparse
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
This is a randomly initialized tiny model based on [meituan-longcat/LongCat-Flash-Lite-Sparse](https://huggingface.co/meituan-longcat/LongCat-Flash-Lite-Sparse) for testing and debugging.
|
| 9 |
+
|
| 10 |
+
| Feature | Source | This repo |
|
| 11 |
+
|---|---|---|
|
| 12 |
+
| Checkpoint tensor elements | 69.11B BF16, 17.26M F32 | 11.72M BF16, 5.76K F32 |
|
| 13 |
+
| Safetensors weight files | 138.29 GB (26 files) | 23.53 MB (model.safetensors) |
|
| 14 |
+
| Logical layers (attention sublayers) | 14 (28) | 4 (8) |
|
| 15 |
+
| Hidden width / dense MLP / expert MLP | 3,072 / 6,144 / 1,024 | 8 / 64 / 32 |
|
| 16 |
+
| Q heads / MLA nope-rope-v head dims | 32 / 128-64-128 | 8 / 64-64-128 |
|
| 17 |
+
| MLA q-lora / kv-lora rank | 1,536 / 512 | 32 / 256 |
|
| 18 |
+
| Routed / identity zero experts, top-k | 256 / 128, 12 | 32 / 128, 12 |
|
| 19 |
+
| LSA index heads / head dim / top-k | 16 / 128 / 2,048 | Same |
|
| 20 |
+
| CLI factor / local + init tokens | 2 / 1,024 + 16 | Same |
|
| 21 |
+
| Over-embedding tables | 12 tables, ~10.22M rows each | 2 tables, ~524k rows |
|
| 22 |
+
| MTP/NextN draft layers | 1 (with LSA indexer) | Same |
|
| 23 |
+
| Attention / RoPE | LSA + deepseek-yarn, 1M context | Same |
|
| 24 |
+
| Vocabulary rows / tying | 131,072 / untied | Same |
|
| 25 |
+
| Routers / correction bias | FP32 | Same |
|
| 26 |
+
| Stored precision | BF16 | Same |
|
| 27 |
+
|
| 28 |
+
The source repo ships no model code and no Transformers implementation (`config.json` has no `model_type` or `auto_map`); SGLang recognizes its `LongcatCausalLM` architecture through its `longcat_flash` config parser and DSA indexer. The tiny tensors were generated directly against that loader's state-dict schema and key remapping, including the nested `model.ngram_embeddings.{embedders,post_projs}.*` over-embedding names (newer SGLang also accepts the source checkpoint's flattened `oe_embed_tokens*.weight` aliases) and the `model.mtp.*` NextN draft. The n-gram hash modulus is internal embedding machinery rather than an externally visible task space, so it follows the smaller [tiny-random/longcat-flash-lite](https://huggingface.co/tiny-random/longcat-flash-lite) modulus; the 131,072 task vocabulary rows and token ids are unchanged. No local Transformers execution path exists; serve with SGLang (0.5.23.dev384 or newer, which includes LongCat LSA) using the command below.
|
| 29 |
+
|
| 30 |
+
### Example usage
|
| 31 |
+
|
| 32 |
+
#### SGLang serving (✅ verified)
|
| 33 |
+
|
| 34 |
+
LSA is implemented in SGLang (main branch; the LongCat Sparse adaptation landed via PR #32918). The checkpoint keeps the source's LongcatCausalLM architecture and serves text only, like the upstream deployment guide.
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
python3 -m sglang.launch_server \
|
| 38 |
+
--trust-remote-code \
|
| 39 |
+
--model scratch/longcat-flash-lite-sparse \
|
| 40 |
+
--host 0.0.0.0 \
|
| 41 |
+
--port 30000 \
|
| 42 |
+
--tp-size 4 \
|
| 43 |
+
--max-running-requests 64 \
|
| 44 |
+
--mem-fraction-static 0.93 \
|
| 45 |
+
--chunked-prefill-size 2048 \
|
| 46 |
+
--dsa-prefill-backend fa3 \
|
| 47 |
+
--kv-cache-dtype bfloat16
|
| 48 |
+
|
| 49 |
+
curl http://127.0.0.1:30000/v1/chat/completions \
|
| 50 |
+
-H 'Content-Type: application/json' \
|
| 51 |
+
-d '{"messages": [{"role": "user", "content": "Hello, world!"}], "max_tokens": 16}'
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
### Creating this repo
|
| 55 |
+
|
| 56 |
+
- Code: [.meta/create_model.py](.meta/create_model.py)
|
| 57 |
+
- Model structure: [.meta/model.log](.meta/model.log)
|
| 58 |
+
- Environment: [.meta/env.json](.meta/env.json)
|
| 59 |
+
|
| 60 |
+
### Change log
|
| 61 |
+
|
| 62 |
+
- 2026-11-03: Initial version. Direct SGLang-schema checkpoint: Transformers has no implementation for the LongCat Sparse Attention (LSA) repo (no model_type/auto_map), so tensors follow the pinned sgl-project/sglang main loader (`longcat_flash.py` plus the DSA `Indexer`). Four dual-sublayer logical layers (eight attention sublayers) keep the shortcut-MoE topology with 32 routed and 128 weightless identity zero experts at top-k 12, compressed MLA ranks (q 32 / kv 256, the Hopper FA3 compressed-latent q_v kernel floor; the source uses kv 512) with 8 Q heads, 64/64 nope/rope and the source 128 value head dim (qk 128 + v 128 matches the Hopper FA3 MHA/MLA head-dim windows), and LSA indexers with the source 16 heads / head dim 128 on every even physical attention layer (CLI factor 2). One MTP/NextN draft layer with its own indexer is serialized under `model.mtp.*`; over-embeddings use the loader-native nested ngram names and the sibling tiny modulus (ratio 4, 2 x 2 windows) instead of the source 10.2-million-row hash tables.
|
| 63 |
+
|
| 64 |
+
*This repo is generated by GPT-6.1-Sol.*
|
config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LongcatCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"vocab_size": 131072,
|
| 8 |
+
"hidden_size": 8,
|
| 9 |
+
"ffn_hidden_size": 64,
|
| 10 |
+
"expert_ffn_hidden_size": 32,
|
| 11 |
+
"num_layers": 4,
|
| 12 |
+
"num_attention_heads": 8,
|
| 13 |
+
"kv_lora_rank": 256,
|
| 14 |
+
"q_lora_rank": 32,
|
| 15 |
+
"qk_rope_head_dim": 64,
|
| 16 |
+
"v_head_dim": 128,
|
| 17 |
+
"qk_nope_head_dim": 64,
|
| 18 |
+
"mla_scale_q_lora": true,
|
| 19 |
+
"mla_scale_kv_lora": true,
|
| 20 |
+
"routed_scaling_factor": 6.0,
|
| 21 |
+
"n_routed_experts": 32,
|
| 22 |
+
"max_position_embeddings": 983040,
|
| 23 |
+
"rms_norm_eps": 1e-05,
|
| 24 |
+
"use_cache": true,
|
| 25 |
+
"bos_token_id": 1,
|
| 26 |
+
"eos_token_id": 2,
|
| 27 |
+
"rope_theta": 1000000.0,
|
| 28 |
+
"rope_scaling": {
|
| 29 |
+
"original_max_position_embeddings": 8192,
|
| 30 |
+
"rope_type": "deepseek_yarn",
|
| 31 |
+
"factor": 120,
|
| 32 |
+
"beta_fast": 32,
|
| 33 |
+
"beta_slow": 1,
|
| 34 |
+
"mscale": 1,
|
| 35 |
+
"mscale_all_dim": 1
|
| 36 |
+
},
|
| 37 |
+
"attention_method": "LSA",
|
| 38 |
+
"zero_expert_num": 128,
|
| 39 |
+
"zero_expert_type": "identity",
|
| 40 |
+
"moe_topk": 12,
|
| 41 |
+
"use_mla": 1,
|
| 42 |
+
"moe_switch_token_num": 1024,
|
| 43 |
+
"moe_impl": "mix",
|
| 44 |
+
"oe_vocab_size_ratio": 4,
|
| 45 |
+
"oe_neighbor_num": 2,
|
| 46 |
+
"oe_split_num": 2,
|
| 47 |
+
"mtp_num_layers": 3,
|
| 48 |
+
"mtp_replicate_modules": true,
|
| 49 |
+
"mtp_disable_over_tokenizer": false,
|
| 50 |
+
"indexer_rope_interleave": true,
|
| 51 |
+
"index_n_heads": 16,
|
| 52 |
+
"index_head_dim": 128,
|
| 53 |
+
"index_topk": 2048,
|
| 54 |
+
"index_k_norm_type": "rms",
|
| 55 |
+
"cli_factor": 2,
|
| 56 |
+
"dsa_mtp_cli": true,
|
| 57 |
+
"index_local_tokens": 1024,
|
| 58 |
+
"index_init_tokens": 16,
|
| 59 |
+
"num_indexer_layers": 8
|
| 60 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"pad_token_id": 3,
|
| 6 |
+
"transformers_version": "4.57.6",
|
| 7 |
+
"repetition_penalty": 1.06,
|
| 8 |
+
"temperature": 0.7,
|
| 9 |
+
"top_p": 0.95,
|
| 10 |
+
"top_k": 4
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b111d4db9736604ddb8056de5512cab0cd1dcb33179178c527f8b5399fe7078f
|
| 3 |
+
size 23527512
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<longcat_s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</longcat_s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<longcat_pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<longcat_unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_eos_token": true,
|
| 4 |
+
"add_prefix_space": false,
|
| 5 |
+
"bos_token": {
|
| 6 |
+
"__type": "AddedToken",
|
| 7 |
+
"content": "<longcat_s>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": true,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false
|
| 12 |
+
},
|
| 13 |
+
"clean_up_tokenization_spaces": false,
|
| 14 |
+
"eos_token": {
|
| 15 |
+
"__type": "AddedToken",
|
| 16 |
+
"content": "</longcat_s>",
|
| 17 |
+
"lstrip": false,
|
| 18 |
+
"normalized": true,
|
| 19 |
+
"rstrip": false,
|
| 20 |
+
"single_word": false
|
| 21 |
+
},
|
| 22 |
+
"model_max_length": 131072,
|
| 23 |
+
"pad_token": {
|
| 24 |
+
"__type": "AddedToken",
|
| 25 |
+
"content": "<longcat_pad>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": true,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
},
|
| 31 |
+
"sp_model_kwargs": {},
|
| 32 |
+
"tokenizer_class": "BloomTokenizer",
|
| 33 |
+
"unk_token": {
|
| 34 |
+
"__type": "AddedToken",
|
| 35 |
+
"content": "<longcat_unk>",
|
| 36 |
+
"lstrip": false,
|
| 37 |
+
"normalized": true,
|
| 38 |
+
"rstrip": false,
|
| 39 |
+
"single_word": false
|
| 40 |
+
},
|
| 41 |
+
"chat_template": "{%- set tool_choice = tool_choice | default('auto') -%}\n{%- set enable_thinking = enable_thinking | default(none) -%}\n{%- set save_history_reasoning_content = save_history_reasoning_content | default(false) -%}\n{%- set ns = namespace(final_messages = [], tool_types = [], last_query_index = -1) -%}\n{%- for message in messages -%}\n {%- set role = message.get('role') -%}\n {%- set c = message.get('content') -%}\n {%- if c is string -%}\n {%- set ns.final_messages = ns.final_messages + [message] -%}\n {%- elif c is iterable and c is not mapping -%}\n {%- set parts = namespace(text=[], thinking=[], tool_calls=[], tool_results=[]) -%}\n {%- for item in c -%}\n {%- if item['type'] == 'text' -%}\n {%- set parts.text = parts.text + [item['text']] -%}\n {%- elif item['type'] == 'thinking' -%}\n {%- if item['thinking'] -%}\n {%- set parts.thinking = parts.thinking + [item['thinking']] -%}\n {%- endif -%}\n {%- elif item['type'] == 'tool_use' -%}\n {%- set parts.tool_calls = parts.tool_calls + [{\n 'id': item['id'],\n 'type': 'function',\n 'function': {\n 'name': item['name'],\n 'arguments': item['input']\n }\n }] -%}\n {%- elif item['type'] == 'tool_result' -%}\n {%- set parts.tool_results = parts.tool_results + [{\n 'role': 'tool',\n 'name': item.get('name', ''),\n 'tool_call_id': item['tool_use_id'],\n 'content': item['content']\n }] -%}\n {%- endif -%}\n {%- endfor -%}\n {%- set ns.final_messages = ns.final_messages + parts.tool_results -%}\n {%- if not (parts.tool_results | length > 0 and parts.text | length == 0 and role == 'user') -%}\n {%- set ns.final_messages = ns.final_messages + [{\n 'role': role,\n 'content': parts.text | join(''),\n 'reasoning_content': parts.thinking | join(''),\n 'tool_calls': parts.tool_calls\n }] -%}\n {%- endif -%}\n {%- else -%}\n {%- set ns.final_messages = ns.final_messages + [message] -%}\n {%- endif -%}\n{%- endfor -%}\n{%- set messages = ns.final_messages -%}\n\n{%- for idx in range(messages|length) -%}\n {%- set msg = messages[idx] -%}\n {%- if msg.role == 'user' -%}\n {%- set ns.last_query_index = idx -%}\n {%- endif -%}\n{%- endfor -%}\n\n{%- if tools and tool_choice != 'none' -%}\n {{- \"<longcat_tool_declare>\\n\" -}}\n {{- \"# Tools\\n\" -}}\n {{- \"You have access to the following tools:\\n\\n\" -}}\n {%- for tool in tools -%}\n {%- if tool.type not in ns.tool_types -%}\n {%- set ns.tool_types = ns.tool_types + [tool.type] -%}\n {{- \"## Tool namespace: \" ~ tool.type ~ \"\\n\\n\" -}}\n {%- endif -%}\n {%- if tool.type == 'code_interpreter' -%}\n {%- set tool = {\"type\":\"code_interpreter\",\"function\":{\"name\":\"code_interpreter_preview\",\"description\":\"The code will be executed in a stateful Jupyter notebook sandbox environment, only supports local computation, data processing, and file operations.\\nCode sandbox environment (network isolated) Any external network requests or online API calls are prohibited.\\nIf online functionality is needed, please use other permitted tools.\\nCode will respond with the output of the execution or time out after 60.0 seconds. \",\"parameters\":{\"type\":\"object\",\"properties\":{\"language\":{\"type\":\"string\",\"description\":\"The programming language of the code to be executed. Available values: python (Default), java, go, js, ts, c, c++.\"},\"code\":{\"type\":\"string\",\"description\":\"Python code to be executed must not include the following:\\n- Importing network libraries such as requests, httplib, etc.\\n- Any form of HTTP requests.\\n- External API calls.\\n- Network port operations. Example: ```python\\nimport pandas as pd\\npd.DataFrame({'A':[1,2]})\\n```\"},\"timeout\":{\"type\":\"number\",\"description\":\"The maximum execution time of the code, in seconds. Default is 60.0.\"}}},\"required\":[\"code\"]}} -%}\n {%- endif -%}\n {{- \"### Tool name: \" + tool.function.name + \"\\n\" -}}\n {{- \"Description: \" + tool.function.description + \"\\n\\n\" -}}\n {{- \"InputSchema: \" + tool.function.parameters | tojson(ensure_ascii=False) + \"\\n\\n\" -}}\n {%- endfor -%}\n {{- '**Note**: For each function call, output the function name and arguments within the following XML format:\\n<longcat_tool_call>{function-name}\\n<longcat_arg_key>{arg-key-1}</longcat_arg_key>\\n<longcat_arg_value>{arg-value-1}</longcat_arg_value>\\n<longcat_arg_key>{arg-key-2}</longcat_arg_key>\\n<longcat_arg_value>{arg-value-2}</longcat_arg_value>\\n...\\n</longcat_tool_call>\\n' -}}\n {{- \"</longcat_tool_declare>\"-}}\n{%- endif -%}\n\n{%- for msg in messages -%}\n {%- if msg.role == \"system\" -%}\n {{- \"<longcat_system>\" + msg.content -}}\n {%- elif msg.role == \"user\" -%}\n {{- \"<longcat_user>\" -}}\n {%- if msg[\"files\"] -%}\n {{- '<longcat_files>\\n' ~ msg.files | tojson(indent=2) ~ '\\n</longcat_files>' -}}\n {%- endif -%}\n {{- msg.content -}}\n {%- if save_history_reasoning_content and enable_thinking is not none -%}\n {%- if loop.last or messages[loop.index0 + 1].role != 'assistant' -%}\n {# pass #}\n {%- else -%}\n {%- if enable_thinking == true -%}\n {{- \" /think_on\" -}}\n {%- if thinking_budget -%}\n {%- if thinking_budget < 1024 -%}\n {%- set thinking_budget = 1024 -%}\n {%- endif -%}\n {{- \"\\nthinking_budget: < \" ~ thinking_budget ~ \".\" -}}\n {%- endif -%}\n {{- \" \" -}}\n {%- elif enable_thinking == false -%}\n {{- \" /think_off \" -}}\n {%- endif -%}\n {%- endif -%}\n {%- elif loop.index0 >= ns.last_query_index and enable_thinking is not none -%}\n {%- if loop.last or messages[loop.index0 + 1].role != 'assistant' -%}\n {# pass #}\n {%- else -%}\n {%- if enable_thinking == true -%}\n {{- \" /think_on\" -}}\n {%- if thinking_budget -%}\n {%- if thinking_budget < 1024 -%}\n {%- set thinking_budget = 1024 -%}\n {%- endif -%}\n {{- \"\\nthinking_budget: < \" ~ thinking_budget ~ \".\" -}}\n {%- endif -%}\n {{- \" \" -}}\n {%- elif enable_thinking == false -%}\n {{- \" /think_off \" -}}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n {%- elif msg.role == \"assistant\" -%}\n {{- \"<longcat_assistant>\" -}}\n {%- if save_history_reasoning_content == true or loop.index0 > ns.last_query_index -%}\n {%- if enable_thinking == true -%}\n {%- if msg.reasoning_content -%}\n {%- set reasoning_content = msg.reasoning_content | trim -%}\n {{- \"<longcat_think>\\n\" ~ reasoning_content ~ \"\\n</longcat_think>\\n\" -}}\n {%- else -%}\n {{- \"<longcat_think>\\n\\n</longcat_think>\\n\" -}}\n {%- endif -%}\n {%- elif enable_thinking == false -%}\n {{- \"<longcat_think>\\n\\n</longcat_think>\\n\" -}}\n {%- endif -%}\n {%- endif -%}\n {%- if msg.content -%}\n {{- msg.content -}}\n {%- endif -%}\n {%- if msg.tool_calls -%}\n {%- for tool_call in msg.tool_calls -%}\n {{- \"<longcat_tool_call>\" ~ tool_call.function.name ~ \"\\n\" -}}\n {%- set _args = tool_call.function.arguments -%}\n {%- for k, v in _args.items() -%}\n {{- \"<longcat_arg_key>\" ~ k ~ \"</longcat_arg_key>\\n\" -}}\n {{- \"<longcat_arg_value>\" ~ (v if v is string else v | tojson(ensure_ascii=False)) ~ \"</longcat_arg_value>\\n\" -}}\n {% endfor -%}\n {{- \"</longcat_tool_call>\\n\" -}}\n {%- endfor -%}\n {%- endif -%}\n {{- \"</longcat_s>\" -}}\n {%- elif msg.role == \"tool\" -%}\n {%- if messages[loop.index0 - 1].role != \"tool\" -%}\n {{- \"<longcat_observation>\" -}}\n {%- endif -%}\n {{- \"<longcat_tool_response>\" ~ msg.name ~ \"\\n\" ~ msg.content ~ \"</longcat_tool_response>\" -}}\n {%- if loop.index0 == messages|length - 1 -%}\n {# pass #}\n {%- elif (save_history_reasoning_content or loop.index0 > ns.last_query_index) and messages[loop.index0 + 1].role != \"tool\" -%}\n {%- if enable_thinking == true -%}\n {{- \" /think_on\" -}}\n {%- if thinking_budget -%}\n {%- if thinking_budget < 1024 -%}\n {%- set thinking_budget = 1024 -%}\n {%- endif -%}\n {{- \"\\nthinking_budget: < \" ~ thinking_budget ~ \".\" -}}\n {%- endif -%}\n {{- \" \" -}}\n {%- elif enable_thinking == false -%}\n {{- \" /think_off \" -}}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {%- if enable_thinking == true -%}\n {{- \" /think_on\" -}}\n {%- if thinking_budget -%}\n {%- if thinking_budget < 1024 -%}\n {%- set thinking_budget = 1024 -%}\n {%- endif -%}\n {{- \"\\nthinking_budget: < \" ~ thinking_budget ~ \".\" -}}\n {%- endif -%}\n {{- \" <longcat_assistant><longcat_think>\\n\" -}}\n {%- elif enable_thinking == false -%}\n {{- \" /think_off <longcat_assistant><longcat_think>\\n\\n</longcat_think>\\n\" -}}\n {%- else -%}\n {{- \"<longcat_assistant>\" -}}\n {%- endif -%}\n{%- endif -%}"
|
| 42 |
+
}
|