yujiepan commited on
Commit
12aaacd
·
verified ·
1 Parent(s): 7ba3345

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
.meta.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "torch": "2.11.0+cu128",
3
+ "transformers": "5.15.0.dev0"
4
+ }
README.md ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ base_model:
4
+ - thinkingmachines/Inkling
5
+ ---
6
+
7
+ This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [thinkingmachines/Inkling](https://huggingface.co/thinkingmachines/Inkling).
8
+
9
+ | File path | Size |
10
+ |------|------|
11
+ | model.safetensors | 7.3MB |
12
+
13
+
14
+ ### Example usage:
15
+
16
+ ```python
17
+ import numpy as np
18
+ import torch
19
+ from PIL import Image
20
+ from transformers import AutoModelForMultimodalLM, AutoProcessor
21
+
22
+ model_id = "tiny-random/inkling"
23
+ processor = AutoProcessor.from_pretrained(model_id)
24
+ model = AutoModelForMultimodalLM.from_pretrained(
25
+ model_id,
26
+ dtype=torch.bfloat16,
27
+ device_map="cuda" if torch.cuda.is_available() else "cpu",
28
+ )
29
+
30
+ # Synthetic multimodal inputs — no network fetch.
31
+ image = Image.fromarray(np.random.randint(0, 255, (80, 80, 3), dtype=np.uint8))
32
+ sampling_rate = processor.feature_extractor.sampling_rate
33
+ t = np.linspace(0, 0.2, int(sampling_rate * 0.2), endpoint=False)
34
+ audio = (0.1 * np.sin(2 * np.pi * 440 * t)).astype(np.float32)
35
+
36
+ messages = [
37
+ {
38
+ "role": "user",
39
+ "content": [
40
+ {"type": "image", "image": image},
41
+ {"type": "audio", "audio": audio},
42
+ {"type": "text", "text": "Describe the image and audio briefly."},
43
+ ],
44
+ },
45
+ ]
46
+ inputs = processor.apply_chat_template(
47
+ messages,
48
+ add_generation_prompt=True,
49
+ tokenize=True,
50
+ return_dict=True,
51
+ return_tensors="pt",
52
+ reasoning_effort="none",
53
+ processor_kwargs={"sampling_rate": sampling_rate},
54
+ ).to(model.device, dtype=model.dtype)
55
+ input_len = inputs["input_ids"].shape[-1]
56
+ outputs = model.generate(**inputs, max_new_tokens=16)
57
+ print(processor.decode(outputs[0], skip_special_tokens=False))
58
+ ```
59
+
60
+ ### Codes to create this repo:
61
+
62
+ <details><summary>Click to expand</summary>
63
+
64
+ ```python
65
+ import json
66
+ from pathlib import Path
67
+
68
+ import torch
69
+ from huggingface_hub import file_exists, hf_hub_download
70
+ from safetensors.torch import load_file, save_file
71
+ from transformers import (
72
+ AutoConfig,
73
+ AutoProcessor,
74
+ GenerationConfig,
75
+ InklingForConditionalGeneration,
76
+ set_seed,
77
+ )
78
+
79
+ source_model_id = "thinkingmachines/Inkling"
80
+ save_folder = "/tmp/tiny-random/inkling"
81
+
82
+ processor = AutoProcessor.from_pretrained(source_model_id)
83
+ processor.save_pretrained(save_folder)
84
+
85
+ with open(hf_hub_download(source_model_id, filename='config.json', repo_type='model'), 'r', encoding='utf-8') as f:
86
+ config_json = json.load(f)
87
+
88
+ # Only shrink size-critical dims. Keep kernel-sensitive knobs (d_rel, rel_extent,
89
+ # sliding_window_size, num_experts_per_tok, n_shared_experts, ...) as upstream.
90
+ hidden_size = 8
91
+ num_mtp_layers = 1
92
+ config_json['text_config'].update({
93
+ 'hidden_size': hidden_size,
94
+ 'num_hidden_layers': 2,
95
+ 'num_attention_heads': 8,
96
+ 'num_key_value_heads': 4,
97
+ 'head_dim': 32,
98
+ 'swa_num_attention_heads': 8,
99
+ 'swa_num_key_value_heads': 4,
100
+ 'swa_head_dim': 32,
101
+ 'local_layer_ids': [0], # keep 1 sliding + 1 global with 2 layers
102
+ 'dense_mlp_idx': 1, # 1 dense + 1 sparse
103
+ 'dense_intermediate_size': 32,
104
+ 'intermediate_size': 32,
105
+ 'moe_intermediate_size': 32,
106
+ })
107
+ config_json['vision_config'].update({
108
+ 'decoder_dmodel': hidden_size,
109
+ 'n_layers': 2,
110
+ })
111
+ config_json['audio_config'].update({
112
+ 'decoder_dmodel': hidden_size,
113
+ })
114
+ config_json['mtp_config'].update({
115
+ 'num_nextn_predict_layers': num_mtp_layers,
116
+ 'local_layer_ids': [0],
117
+ })
118
+
119
+ with open(f"{save_folder}/config.json", "w", encoding='utf-8') as f:
120
+ json.dump(config_json, f, indent=2)
121
+
122
+ config = AutoConfig.from_pretrained(save_folder)
123
+ print(config)
124
+ torch.set_default_dtype(torch.bfloat16)
125
+ model = InklingForConditionalGeneration(config)
126
+ torch.set_default_dtype(torch.float32)
127
+ if file_exists(filename="generation_config.json", repo_id=source_model_id, repo_type='model'):
128
+ model.generation_config = GenerationConfig.from_pretrained(
129
+ source_model_id, trust_remote_code=True,
130
+ )
131
+ set_seed(42)
132
+ model = model.cpu()
133
+ num_params = sum(p.numel() for p in model.parameters())
134
+ with torch.no_grad():
135
+ for name, p in sorted(model.named_parameters()):
136
+ torch.nn.init.normal_(p, 0, 0.2)
137
+ print(name, p.shape, f'{p.numel() / num_params:.2%}', f'{p.numel() * p.element_size() / 1024**2:.2f}MB')
138
+ # Upstream MoE gate bias / global_scale are F32; sconv stays BF16 in the checkpoint.
139
+ for name, module in model.named_modules():
140
+ if hasattr(module, "e_score_correction_bias"):
141
+ module.e_score_correction_bias = torch.nn.Parameter(
142
+ module.e_score_correction_bias.detach().float()
143
+ )
144
+ if name.endswith(".mlp.gate") and hasattr(module, "global_scale"):
145
+ module.global_scale = torch.nn.Parameter(module.global_scale.detach().float())
146
+ model.save_pretrained(save_folder)
147
+
148
+ # HF ignores `model.mtp.*` on main load; write them with original checkpoint naming.
149
+ set_seed(42)
150
+ path = Path(save_folder) / "model.safetensors"
151
+ state = load_file(str(path))
152
+ dense_prefix = "model.llm.layers.0." # MTP blocks are dense
153
+ dense_keys = {k: v for k, v in state.items() if k.startswith(dense_prefix)}
154
+ for i in range(num_mtp_layers):
155
+ block_prefix = f"model.mtp.layers.{i}.transformer_block."
156
+ for src_key, tensor in dense_keys.items():
157
+ dst_key = block_prefix + src_key[len(dense_prefix):]
158
+ state[dst_key] = torch.empty_like(tensor)
159
+ torch.nn.init.normal_(state[dst_key], 0, 0.2)
160
+ print(dst_key, tuple(state[dst_key].shape))
161
+ for name, shape in (
162
+ (f"model.mtp.layers.{i}.embed_norm.weight", (hidden_size,)),
163
+ (f"model.mtp.layers.{i}.hidden_norm.weight", (hidden_size,)),
164
+ (f"model.mtp.layers.{i}.input_proj.weight", (hidden_size, hidden_size * 2)),
165
+ ):
166
+ state[name] = torch.empty(shape, dtype=torch.bfloat16)
167
+ torch.nn.init.normal_(state[name], 0, 0.2)
168
+ print(name, shape)
169
+ # Keep checkpoint key dtypes aligned even if save_pretrained downcasts.
170
+ for key, tensor in list(state.items()):
171
+ if key.endswith(".mlp.gate.bias") or key.endswith(".mlp.gate.global_scale"):
172
+ state[key] = tensor.float()
173
+ save_file(state, str(path))
174
+ ```
175
+
176
+ </details>
177
+
178
+ ### Printing the model:
179
+
180
+ <details><summary>Click to expand</summary>
181
+
182
+ ```text
183
+ InklingForConditionalGeneration(
184
+ (model): InklingModel(
185
+ (language_model): InklingTextModel(
186
+ (embed_tokens): Embedding(201024, 8)
187
+ (layers): ModuleList(
188
+ (0): InklingDecoderLayer(
189
+ (self_attn): InklingAttention(
190
+ (q_proj): Linear(in_features=8, out_features=256, bias=False)
191
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
192
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
193
+ (r_proj): Linear(in_features=8, out_features=128, bias=False)
194
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
195
+ (k_sconv): InklingShortConvolution(
196
+ (conv1d): Conv1d(128, 128, kernel_size=(4,), stride=(1,), padding=(3,), groups=128, bias=False)
197
+ )
198
+ (v_sconv): InklingShortConvolution(
199
+ (conv1d): Conv1d(128, 128, kernel_size=(4,), stride=(1,), padding=(3,), groups=128, bias=False)
200
+ )
201
+ (q_norm): InklingRMSNorm((32,), eps=1e-06)
202
+ (k_norm): InklingRMSNorm((32,), eps=1e-06)
203
+ (rel_logits_proj): InklingRelativeLogits()
204
+ )
205
+ (mlp): InklingMLP(
206
+ (gate_proj): Linear(in_features=8, out_features=32, bias=False)
207
+ (up_proj): Linear(in_features=8, out_features=32, bias=False)
208
+ (down_proj): Linear(in_features=32, out_features=8, bias=False)
209
+ (act_fn): SiLUActivation()
210
+ )
211
+ (input_layernorm): InklingRMSNorm((8,), eps=1e-06)
212
+ (post_attention_layernorm): InklingRMSNorm((8,), eps=1e-06)
213
+ (attn_sconv): InklingShortConvolution(
214
+ (conv1d): Conv1d(8, 8, kernel_size=(4,), stride=(1,), padding=(3,), groups=8, bias=False)
215
+ )
216
+ (mlp_sconv): InklingShortConvolution(
217
+ (conv1d): Conv1d(8, 8, kernel_size=(4,), stride=(1,), padding=(3,), groups=8, bias=False)
218
+ )
219
+ )
220
+ (1): InklingDecoderLayer(
221
+ (self_attn): InklingAttention(
222
+ (q_proj): Linear(in_features=8, out_features=256, bias=False)
223
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
224
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
225
+ (r_proj): Linear(in_features=8, out_features=128, bias=False)
226
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
227
+ (k_sconv): InklingShortConvolution(
228
+ (conv1d): Conv1d(128, 128, kernel_size=(4,), stride=(1,), padding=(3,), groups=128, bias=False)
229
+ )
230
+ (v_sconv): InklingShortConvolution(
231
+ (conv1d): Conv1d(128, 128, kernel_size=(4,), stride=(1,), padding=(3,), groups=128, bias=False)
232
+ )
233
+ (q_norm): InklingRMSNorm((32,), eps=1e-06)
234
+ (k_norm): InklingRMSNorm((32,), eps=1e-06)
235
+ (rel_logits_proj): InklingRelativeLogits()
236
+ )
237
+ (mlp): InklingMoE(
238
+ (gate): InklingTopkRouter()
239
+ (experts): InklingExperts(
240
+ (act_fn): SiLUActivation()
241
+ )
242
+ (shared_experts): InklingSharedExperts(
243
+ (act_fn): SiLUActivation()
244
+ )
245
+ )
246
+ (input_layernorm): InklingRMSNorm((8,), eps=1e-06)
247
+ (post_attention_layernorm): InklingRMSNorm((8,), eps=1e-06)
248
+ (attn_sconv): InklingShortConvolution(
249
+ (conv1d): Conv1d(8, 8, kernel_size=(4,), stride=(1,), padding=(3,), groups=8, bias=False)
250
+ )
251
+ (mlp_sconv): InklingShortConvolution(
252
+ (conv1d): Conv1d(8, 8, kernel_size=(4,), stride=(1,), padding=(3,), groups=8, bias=False)
253
+ )
254
+ )
255
+ )
256
+ (norm): InklingRMSNorm((8,), eps=1e-06)
257
+ (embed_norm): InklingRMSNorm((8,), eps=1e-06)
258
+ )
259
+ (audio_tower): InklingAudioModel(
260
+ (embed_audio_tokens): InklingAudioModelEmbeddings(
261
+ (embed_audio_tokens): Embedding(1280, 8)
262
+ )
263
+ (norm): InklingRMSNorm((8,), eps=1e-06)
264
+ )
265
+ (vision_tower): InklingVisionModel(
266
+ (encoder_layers): ModuleList(
267
+ (0): InklingVisionEncoderLayer(
268
+ (projection): Linear(in_features=300, out_features=320, bias=False)
269
+ (layer_norm): InklingRMSNorm((320,), eps=1e-06)
270
+ )
271
+ (1): InklingVisionEncoderLayer(
272
+ (projection): Linear(in_features=10240, out_features=8, bias=False)
273
+ )
274
+ )
275
+ (final_norm): InklingRMSNorm((8,), eps=1e-06)
276
+ )
277
+ )
278
+ (lm_head): Linear(in_features=8, out_features=201024, bias=False)
279
+ )
280
+ ```
281
+
282
+ </details>
283
+
284
+ ### Test environment:
285
+
286
+ - torch: 2.11.0+cu128
287
+ - transformers: 5.15.0.dev0
chat_template.jinja ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set effort_map = {"none": 0.0, "minimal": 0.1, "low": 0.2, "medium": 0.7, "high": 0.9, "max": 0.99} -%}
2
+ {%- set role_token = {"user": "<|message_user|>", "assistant": "<|message_model|>", "system": "<|message_system|>", "tool": "<|message_tool|>"} -%}
3
+
4
+ {%- macro emit_thinking_effort() -%}
5
+ {%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.9 -%}
6
+ {%- if eff is string -%}
7
+ {%- set key = eff | trim -%}
8
+ {%- if key not in effort_map -%}
9
+ {{- raise_exception("Unknown reasoning_effort: " ~ eff) -}}
10
+ {%- endif -%}
11
+ {%- set num = effort_map[key] -%}
12
+ {%- else -%}
13
+ {%- set num = eff | float -%}
14
+ {%- endif -%}
15
+ {%- if num < 0.0 or num > 0.99 -%}
16
+ {{- raise_exception("reasoning_effort must be in [0.0, 0.99]") -}}
17
+ {%- endif -%}
18
+ {{- "<|message_system|><|content_text|>Thinking effort level: " -}}
19
+ {%- if num == 0.0 -%}0{%- else -%}{{ num }}{%- endif -%}
20
+ {{- "<|end_message|>" -}}
21
+ {%- endmacro -%}
22
+
23
+ {%- if tools -%}
24
+ {%- set tool_state = namespace(specs=[]) -%}
25
+ {%- for tool in tools -%}
26
+ {%- set fn = tool.function if tool.function is defined else tool -%}
27
+ {%- set spec = {
28
+ "description": (fn.description if fn.description is defined and fn.description else ""),
29
+ "name": fn.name,
30
+ "parameters": (fn.parameters if fn.parameters is defined and fn.parameters else {}),
31
+ "type": (tool.type if tool.type is defined and tool.type else "function"),
32
+ } -%}
33
+ {%- set tool_state.specs = tool_state.specs + [spec] -%}
34
+ {%- endfor -%}
35
+ {{- "<|message_system|>tool_declare<|content_xml|>" -}}
36
+ {{- tool_state.specs | tojson(sort_keys=true, separators=(",", ":")) -}}
37
+ {{- "<|end_message|>" -}}
38
+ {%- endif -%}
39
+
40
+ {%- set state = namespace(effort_emitted=false) -%}
41
+ {%- for message in messages -%}
42
+ {%- if message.role not in role_token -%}
43
+ {{- raise_exception("Unknown message role: " ~ message.role) -}}
44
+ {%- endif -%}
45
+ {%- if not state.effort_emitted and message.role != "system" -%}
46
+ {{- emit_thinking_effort() -}}
47
+ {%- set state.effort_emitted = true -%}
48
+ {%- endif -%}
49
+
50
+ {%- set rtok = role_token[message.role] -%}
51
+
52
+ {%- if message.role == "tool" -%}
53
+ {%- set tool_name_state = namespace(name="") -%}
54
+ {%- if message.name is defined and message.name -%}
55
+ {%- set tool_name_state.name = message.name -%}
56
+ {%- elif message.tool_call_id is defined and message.tool_call_id -%}
57
+ {%- for prev in messages -%}
58
+ {%- if prev.role == "assistant" and prev.tool_calls -%}
59
+ {%- for tc in prev.tool_calls -%}
60
+ {%- if tc.id is defined and tc.id == message.tool_call_id and tc.function.name is defined -%}
61
+ {%- set tool_name_state.name = tc.function.name -%}
62
+ {%- endif -%}
63
+ {%- endfor -%}
64
+ {%- endif -%}
65
+ {%- endfor -%}
66
+ {%- endif -%}
67
+ {{- rtok -}}
68
+ {%- if tool_name_state.name -%}{{- tool_name_state.name -}}{%- endif -%}
69
+ {{- "<|content_text|>" -}}
70
+ {%- if message.content is string -%}{{- message.content -}}{%- endif -%}
71
+ {{- "<|end_message|>" -}}
72
+
73
+ {%- else -%}
74
+ {%- if message.role == "assistant" and message.reasoning_content is defined and message.reasoning_content -%}
75
+ {{- "<|message_model|><|content_thinking|>" ~ message.reasoning_content ~ "<|end_message|>" -}}
76
+ {%- endif -%}
77
+
78
+ {%- if message.content is string -%}
79
+ {{- rtok ~ "<|content_text|>" ~ message.content ~ "<|end_message|>" -}}
80
+ {%- elif message.content -%}
81
+ {%- for part in message.content -%}
82
+ {%- if part is string -%}
83
+ {{- rtok ~ "<|content_text|>" ~ part ~ "<|end_message|>" -}}
84
+ {%- elif part.type is not defined or part.type in ("text", "input_text") -%}
85
+ {%- set text_part = (part.text if part.text is defined and part.text is string else "") -%}
86
+ {{- rtok ~ "<|content_text|>" ~ text_part ~ "<|end_message|>" -}}
87
+ {%- elif part.type in ("image", "input_image", "image_url") -%}
88
+ {{- rtok ~ "<|content_image|><|unused_200054|><|end_message|>" -}}
89
+ {%- elif part.type in ("audio", "input_audio", "audio_url") -%}
90
+ {{- rtok ~ "<|content_audio_input|><|unused_200053|><|audio_end|><|end_message|>" -}}
91
+ {%- else -%}
92
+ {{- raise_exception("Unsupported content part type: " ~ part.type) -}}
93
+ {%- endif -%}
94
+ {%- endfor -%}
95
+ {%- endif -%}
96
+
97
+ {%- if message.role == "assistant" and message.tool_calls -%}
98
+ {%- for tc in message.tool_calls -%}
99
+ {%- set fn = tc.function -%}
100
+ {%- if fn.name is not defined or fn.name is not string -%}
101
+ {{- raise_exception("tool call function name must be a string") -}}
102
+ {%- endif -%}
103
+ {%- set args = fn.arguments if fn.arguments is defined and fn.arguments else {} -%}
104
+ {%- if args is string -%}
105
+ {{- raise_exception("tool call arguments must be a parsed object, not a JSON string; canonicalize upstream") -}}
106
+ {%- endif -%}
107
+ {%- if args is not mapping -%}
108
+ {{- raise_exception("tool call arguments must be an object") -}}
109
+ {%- endif -%}
110
+ {{- "<|message_model|>" ~ fn.name ~ "<|content_invoke_tool_json|>" -}}
111
+ {{- '{"name":' ~ (fn.name | tojson(sort_keys=true, separators=(",", ":"))) ~ ',"args":' -}}
112
+ {{- (args | tojson(sort_keys=true, separators=(",", ":"))) -}}
113
+ {{- "}<|end_message|>" -}}
114
+ {%- endfor -%}
115
+ {%- endif -%}
116
+
117
+ {%- if message.role == "assistant" -%}
118
+ {{- "<|content_model_end_sampling|>" -}}
119
+ {%- endif -%}
120
+ {%- endif -%}
121
+ {%- endfor -%}
122
+
123
+ {%- if not state.effort_emitted -%}
124
+ {{- emit_thinking_effort() -}}
125
+ {%- endif -%}
126
+
127
+ {%- if add_generation_prompt -%}
128
+ {{- "<|message_model|>" -}}
129
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "InklingForConditionalGeneration"
4
+ ],
5
+ "audio_bos_token_id": 200020,
6
+ "audio_config": {
7
+ "audio_mode": "dmel",
8
+ "bias": false,
9
+ "decoder_dmodel": 8,
10
+ "dmel_max_value": 2.0,
11
+ "dmel_min_value": -7.0,
12
+ "initializer_range": 0.02,
13
+ "mel_vocab_size": 16,
14
+ "model_type": "inkling_audio",
15
+ "n_mel_bins": 80,
16
+ "rms_norm_eps": 1e-06,
17
+ "text_hidden_size": 8,
18
+ "use_audio_norm": true
19
+ },
20
+ "audio_token_id": 200053,
21
+ "dtype": "bfloat16",
22
+ "eos_token_id": 200006,
23
+ "image_bos_token_id": 200005,
24
+ "image_token_id": 200054,
25
+ "model_type": "inkling_mm_model",
26
+ "mtp_config": {
27
+ "chain_hidden_post_norm": false,
28
+ "local_layer_ids": [
29
+ 0
30
+ ],
31
+ "num_nextn_predict_layers": 1
32
+ },
33
+ "text_config": {
34
+ "attention_dropout": 0.0,
35
+ "bos_token_id": 1,
36
+ "chain_hidden_post_norm": false,
37
+ "conv_kernel_size": 4,
38
+ "d_rel": 16,
39
+ "dtype": "bfloat16",
40
+ "eos_token_id": 2,
41
+ "final_logit_softcapping": null,
42
+ "gate_activation": "sigmoid",
43
+ "head_dim": 32,
44
+ "hidden_act": "silu",
45
+ "hidden_size": 8,
46
+ "initializer_range": 0.02,
47
+ "intermediate_size": 32,
48
+ "layer_types": [
49
+ "hybrid_sliding",
50
+ "hybrid"
51
+ ],
52
+ "local_layer_ids": [
53
+ 0
54
+ ],
55
+ "log_scaling_alpha": 0.1,
56
+ "log_scaling_n_floor": 128000,
57
+ "logits_mup_width_multiplier": 24.0,
58
+ "max_position_embeddings": 1048576,
59
+ "mlp_layer_types": [
60
+ "dense",
61
+ "sparse"
62
+ ],
63
+ "model_type": "inkling_text",
64
+ "moe_intermediate_size": 32,
65
+ "mtp_hidden_states_first": true,
66
+ "mtp_local_layer_ids": [
67
+ 0
68
+ ],
69
+ "n_routed_experts": 256,
70
+ "n_shared_experts": 2,
71
+ "norm_after_topk": true,
72
+ "num_attention_heads": 8,
73
+ "num_experts_per_tok": 6,
74
+ "num_hidden_layers": 2,
75
+ "num_key_value_heads": 4,
76
+ "num_mtp_layers": 1,
77
+ "number_of_conv_states": 4,
78
+ "o_bias": false,
79
+ "pad_token_id": null,
80
+ "q_bias": false,
81
+ "rel_extent": 1024,
82
+ "rms_norm_eps": 1e-06,
83
+ "rms_norm_eps_moe_gate": 1e-06,
84
+ "route_scale": 8.0,
85
+ "shared_expert_sink": true,
86
+ "sliding_window_size": 512,
87
+ "swa_head_dim": 32,
88
+ "swa_num_attention_heads": 8,
89
+ "swa_num_key_value_heads": 4,
90
+ "unpadded_vocab_size": 200058,
91
+ "use_embed_norm": true,
92
+ "use_gate_bias": true,
93
+ "use_global_scale": true,
94
+ "use_sconv": true,
95
+ "vocab_size": 201024
96
+ },
97
+ "transformers_version": "5.15.0.dev0",
98
+ "vision_config": {
99
+ "decoder_dmodel": 8,
100
+ "hidden_size": 1024,
101
+ "initializer_range": 0.02,
102
+ "model_type": "inkling_vision",
103
+ "n_channels": 3,
104
+ "n_layers": 2,
105
+ "num_attention_heads": 16,
106
+ "num_channels": 3,
107
+ "patch_size": 40,
108
+ "rms_norm_eps": 1e-06,
109
+ "temporal_patch_size": 2,
110
+ "text_hidden_size": 8,
111
+ "use_vision_norm": true,
112
+ "vision_encoder_type": "hmlp"
113
+ }
114
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 200006,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "transformers_version": "5.15.0.dev0"
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b67f75e7f07e189a6dde338347e81a3616b7fed4f3236b0d34c957b69d25887
3
+ size 7337520
processor_config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_bos_token": "<|content_audio_input|>",
3
+ "audio_token": "<|unused_200053|>",
4
+ "dmel_max_value": 2.0,
5
+ "dmel_min_value": -7.0,
6
+ "feature_extractor": {
7
+ "audio_token_duration_s": 0.05,
8
+ "feature_extractor_type": "InklingFeatureExtractor",
9
+ "feature_size": 80,
10
+ "hop_length": 800,
11
+ "n_fft": 1600,
12
+ "padding_side": "right",
13
+ "padding_value": 0.0,
14
+ "return_attention_mask": true,
15
+ "sampling_rate": 16000,
16
+ "window_size": 1600,
17
+ "window_size_multiplier": 2.0
18
+ },
19
+ "image_bos_token": "<|content_image|>",
20
+ "image_processor": {
21
+ "do_convert_rgb": true,
22
+ "do_normalize": true,
23
+ "do_rescale": true,
24
+ "do_resize": true,
25
+ "image_mean": [
26
+ 0.48145466,
27
+ 0.4578275,
28
+ 0.40821073
29
+ ],
30
+ "image_processor_type": "InklingImageProcessor",
31
+ "image_std": [
32
+ 0.26862954,
33
+ 0.26130258,
34
+ 0.27577711
35
+ ],
36
+ "resample": 3,
37
+ "rescale_factor": 0.00392156862745098,
38
+ "rescale_image_max_upscaled_long_edge": 2048,
39
+ "size": {
40
+ "height": 40,
41
+ "width": 40
42
+ }
43
+ },
44
+ "image_token": "<|unused_200054|>",
45
+ "num_dmel_bins": 16,
46
+ "processor_class": "InklingProcessor"
47
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c470271fb7649eef922e660e757b5f076e2a94adc20df7fad7df85c46bc48eac
3
+ size 27875796
tokenizer_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio": "<|audio|>",
3
+ "audio_end": "<|audio_end|>",
4
+ "backend": "tokenizers",
5
+ "begin_of_text": "<|begin_of_text|>",
6
+ "clean_up_tokenization_spaces": false,
7
+ "content_audio_input": "<|content_audio_input|>",
8
+ "content_image": "<|content_image|>",
9
+ "content_invoke_tool_json": "<|content_invoke_tool_json|>",
10
+ "content_invoke_tool_text": "<|content_invoke_tool_text|>",
11
+ "content_model_end_sampling": "<|content_model_end_sampling|>",
12
+ "content_text": "<|content_text|>",
13
+ "content_thinking": "<|content_thinking|>",
14
+ "content_tool_error": "<|content_tool_error|>",
15
+ "content_xml": "<|content_xml|>",
16
+ "end_message": "<|end_message|>",
17
+ "endoftext": "<|endoftext|>",
18
+ "fix_mistral_regex": false,
19
+ "is_local": false,
20
+ "local_files_only": false,
21
+ "message_model": "<|message_model|>",
22
+ "message_system": "<|message_system|>",
23
+ "message_tool": "<|message_tool|>",
24
+ "message_user": "<|message_user|>",
25
+ "model_max_length": 1000000000000000019884624838656,
26
+ "model_specific_special_tokens": {
27
+ "audio": "<|audio|>",
28
+ "audio_end": "<|audio_end|>",
29
+ "begin_of_text": "<|begin_of_text|>",
30
+ "content_audio_input": "<|content_audio_input|>",
31
+ "content_image": "<|content_image|>",
32
+ "content_invoke_tool_json": "<|content_invoke_tool_json|>",
33
+ "content_invoke_tool_text": "<|content_invoke_tool_text|>",
34
+ "content_model_end_sampling": "<|content_model_end_sampling|>",
35
+ "content_text": "<|content_text|>",
36
+ "content_thinking": "<|content_thinking|>",
37
+ "content_tool_error": "<|content_tool_error|>",
38
+ "content_xml": "<|content_xml|>",
39
+ "end_message": "<|end_message|>",
40
+ "endoftext": "<|endoftext|>",
41
+ "message_model": "<|message_model|>",
42
+ "message_system": "<|message_system|>",
43
+ "message_tool": "<|message_tool|>",
44
+ "message_user": "<|message_user|>"
45
+ },
46
+ "processor_class": "InklingProcessor",
47
+ "tokenizer_class": "TokenizersBackend"
48
+ }