Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
ce16fff
Add TML Inkling architecture
danielhanchen Jul 18, 2026
453c438
Merge remote-tracking branch 'origin/master' into pr-25731-head
danielhanchen Jul 23, 2026
e38da9a
Merge remote-tracking branch 'upstream/master' into add-inkling-fix
shimmyshimmer Jul 26, 2026
d8f8750
inkling : adapt to the renamed thinking_end_tags chat API
shimmyshimmer Jul 26, 2026
79ca732
Fix merge conflicts
danielhanchen Jul 29, 2026
8a67b19
Merge upstream master and fix conflicts
danielhanchen Jul 30, 2026
d69b7e6
Fix mmproj decoder width for Inkling Small
danielhanchen Jul 30, 2026
02142bb
Fix some GitHub Issues
danielhanchen Aug 2, 2026
1e6f9e4
Merge tag 'b10229' into add-inkling
danielhanchen Aug 3, 2026
68b15cf
Fix quantized V cache issue
danielhanchen Aug 6, 2026
3fd7901
Fix merge conflicts
danielhanchen Aug 6, 2026
e2404dd
Fix merge conflicts
danielhanchen Aug 10, 2026
0a9841f
Fix merge conflicts
danielhanchen Aug 10, 2026
368b24c
Fix merge conflicts
danielhanchen Aug 12, 2026
c44c9a1
Fix merge conflicts
danielhanchen Aug 17, 2026
b5baf81
Fix merge conflicts
danielhanchen Aug 26, 2026
4f2eb74
Fix merge conflicts
shimmyshimmer Aug 27, 2026
2e9d6fb
Merge remote-tracking branch 'up/master' into add-inkling
shimmyshimmer Aug 28, 2026
edee0e1
Fix merge conflicts
danielhanchen Aug 28, 2026
44eb88e
Merge remote-tracking branch 'origin/master' into add-inkling
danielhanchen Aug 31, 2026
49c0377
Fix merge conflicts
danielhanchen Sep 4, 2026
fe45c89
mtmd: mark the Inkling preprocessors const to match the base class
danielhanchen Sep 4, 2026
36df1bf
tests: give inkling its arch fixture so test-llama-archs stops skippi…
danielhanchen Sep 4, 2026
1066edc
Fix merge conflicts
danielhanchen Sep 7, 2026
d3a6700
Merge upstream master into add-inkling
danielhanchen Sep 9, 2026
946fc11
inkling: move to ggml_prec_set_acc, teach the backends about GGML_PRE…
danielhanchen Sep 9, 2026
3870aa4
Fix merge conflicts
danielhanchen Sep 22, 2026
3d5bf02
Merge master into add-inkling
danielhanchen Nov 13, 2026
eeac951
inkling : give the conv state, memory filter and rel-pos input their …
danielhanchen Nov 14, 2026
287b4ff
Fix merge conflicts
danielhanchen Nov 19, 2026
e2a5260
CUDA: use ggml_cuda_shfl in the banded FA kernel
danielhanchen Nov 19, 2026
7980f5c
model : chunk the Inkling 2 relative-bias attention over query rows
danielhanchen Nov 20, 2026
be9c519
Merge pin #378 (e2a52601a0) into inkling2-attn-chunk
danielhanchen Nov 20, 2026
7c3655c
model : banded flash attention for the Inkling 2 relative bias
danielhanchen Nov 20, 2026
b4c2aab
Fix merge conflicts
danielhanchen Nov 20, 2026
e65c374
Fix merge conflicts
danielhanchen Nov 20, 2026
c9c6322
Trim comments
danielhanchen Nov 20, 2026
8825dc2
Trim comments
danielhanchen Nov 20, 2026
0e45b1d
Fix merge conflicts
danielhanchen Nov 20, 2026
523e465
Fix merge conflicts
danielhanchen Nov 20, 2026
54dcc05
Merge tag 'b12600' into inkling2-attn-chunk
danielhanchen Nov 21, 2026
242a5d8
Merge branch 'inkling2-attn-chunk' (b12600) into inkling2-attn-banded
danielhanchen Nov 21, 2026
c729a87
inkling2 : share normalized block stacks and repeated subexpressions …
danielhanchen Nov 21, 2026
9622501
inkling2 : fill the zero sinks of the dense attention once per graph …
danielhanchen Nov 21, 2026
7db4a70
CUDA: quantized K/V for the banded relative-bias attention
danielhanchen Nov 21, 2026
02b68e6
inkling : banded attention for a quantized K cache
danielhanchen Nov 21, 2026
291a63e
Merge inkling1-b12533 (02b68e647) into inkling2-attn-banded
danielhanchen Nov 21, 2026
493fc82
model : share the banded attention mask of Inkling 2 across layers
danielhanchen Nov 21, 2026
2f96ddb
Merge inkling1-b12533 (1da4c9373) into inkling2-attn-banded
danielhanchen Nov 21, 2026
1da4c93
inkling : share the banded attention mask across layers
danielhanchen Nov 21, 2026
15b7c1a
Merge inkling1-b12533 (1ac4b1c91) into inkling2-attn-banded
danielhanchen Nov 21, 2026
1ac4b1c
kv-cache : banded attention for a sequence stored at a cell offset
danielhanchen Nov 21, 2026
0edf1d6
Merge the Inkling 2 graph dedupe into inkling2-attn-banded
danielhanchen Nov 21, 2026
58d6e4c
metal : add FLASH_ATTN_EXT_BANDED in both attention kernels
skeggsguy Nov 21, 2026
982dee7
metal : do not reserve the vec and F16 K/V scratch for FLASH_ATTN_EXT…
danielhanchen Nov 22, 2026
19360e5
Fix merge conflicts
danielhanchen Nov 22, 2026
6348de2
Fix merge conflicts
danielhanchen Nov 22, 2026
944cd7e
metal : bound the FA pad copy to the K/V row width
danielhanchen Nov 22, 2026
11f7c56
Merge inkling2-attn-banded (6348de261) into metal-banded-pr1
danielhanchen Nov 22, 2026
b64ef9d
metal : refuse FLASH_ATTN_EXT_BANDED when K and V have different head…
danielhanchen Nov 22, 2026
aa8d61c
metal : banded FA, require mask width == n_kv and the row layouts the…
danielhanchen Nov 22, 2026
6751860
metal : banded FA, keep each comment sentence on one line
danielhanchen Nov 22, 2026
6807804
metal : banded FA, trim comments
danielhanchen Nov 22, 2026
ffc03a8
graph : build the dense relative bias in F16 for flash attention
danielhanchen Nov 21, 2026
4fff29a
inkling2 : expand the short convolution inputs and outputs in order
danielhanchen Nov 22, 2026
081c9bb
metal : fix supports_op so the following don't crash for banded flash…
skeggsguy Nov 22, 2026
5442dfa
Merge tag 'b12635' into inkling1-b12533-opcount
danielhanchen Nov 23, 2026
cf37396
ggml : count GGML_OP_FLASH_ATTN_EXT_BANDED on top of GGML_OP_SIGMOID_…
danielhanchen Nov 23, 2026
308adeb
Merge tag 'b12635' into inkling2-attn-banded-opcount
danielhanchen Nov 23, 2026
06322ff
ggml : count GGML_OP_FLASH_ATTN_EXT_BANDED on top of GGML_OP_SIGMOID_…
danielhanchen Nov 23, 2026
34f98d2
inkling2 : keep the relative-bias chunk within the reserved graph
danielhanchen Nov 23, 2026
d4a36c6
Merge branch 'inkling2-attn-chunk' (34f98d255) into inkling2-attn-banded
danielhanchen Nov 23, 2026
7adbb5d
inkling2 : reserve the dense relative bias when a ubatch can hold sev…
danielhanchen Nov 23, 2026
e328b4d
graph : cast the dense relative bias to F16 instead of copying it int…
danielhanchen Nov 23, 2026
4aae13c
inkling2 : write the relative-bias chunks into one output
danielhanchen Nov 23, 2026
6510f1f
inkling2 : reserve the dense bias that one sequence still takes at ru…
danielhanchen Nov 23, 2026
cf09974
Merge branch 'inkling2-attn-chunk' (4aae13c13) into inkling2-attn-banded
danielhanchen Nov 23, 2026
3764480
ggml : read the banded rel_logits split from src[6] in the meta backend
danielhanchen Nov 23, 2026
1c5c0b1
mtmd : do not require v.patch_embd.weight for the Inkling projector
danielhanchen Nov 23, 2026
7cbffd2
tests : fail test-flash-attn-bias on non-finite outputs
danielhanchen Nov 23, 2026
0526ba1
ggml : read the banded rel_logits split from src[6] in the meta backend
danielhanchen Nov 23, 2026
d7bca4f
mtmd : do not require v.patch_embd.weight for the Inkling projector
danielhanchen Nov 23, 2026
e9ecd59
tests : fail test-flash-attn-bias on non-finite outputs
danielhanchen Nov 23, 2026
68df508
CUDA: do not delegate banded attention to MMA when flash attention is…
danielhanchen Nov 23, 2026
210fc26
CUDA: do not delegate banded attention to MMA when flash attention is…
danielhanchen Nov 23, 2026
2c38e50
rpc : count GGML_OP_FLASH_ATTN_EXT_BANDED in the RPC op count
danielhanchen Nov 23, 2026
27f2561
Fix merge conflicts
danielhanchen Nov 24, 2026
777ed55
Merge unslothai/llama.cpp#404 (081c9bbe4) into ink-F-metal-banded
danielhanchen Nov 24, 2026
6e32059
Fix merge conflicts
danielhanchen Nov 24, 2026
ded02bd
Fix merge conflicts
danielhanchen Nov 24, 2026
c56bf57
metal : banded FA in the vec kernels, quantized K/V and BF16 rel tables
danielhanchen Nov 24, 2026
d24b324
ggml : banded flash attention with cell and query positions
danielhanchen Nov 24, 2026
d262c42
inkling2 : banded attention when the cells are not the positions
danielhanchen Nov 24, 2026
566ef55
CUDA: banded attention decode kernel for a few queries
danielhanchen Nov 24, 2026
0c76ff6
tests : banded positions with every quantized K/V type and mixed K/V …
danielhanchen Nov 24, 2026
235fc50
metal : mixed K/V cache types in the FA and banded FA kernels
danielhanchen Nov 24, 2026
5270100
inkling2 : take the banded path for ubatches of 2 to 32 tokens over t…
danielhanchen Nov 24, 2026
56df0d2
ggml : read the banded attention mask in place when it is a view
danielhanchen Nov 24, 2026
bebd19f
kv-cache : check the position contiguity once per applied ubatch
danielhanchen Nov 24, 2026
5b2da95
CUDA: banded decode kernel reads q4_1 / q5_0 / q5_1 and mixed q8_0 K …
danielhanchen Nov 24, 2026
c83521b
Merge ink-B-multiseq: banded attention with cell positions
danielhanchen Nov 24, 2026
0ffac90
Merge ink-B-multiseq tests: banded positions with every quantized K/V…
danielhanchen Nov 24, 2026
fd96634
Merge #386 merge probe (b12668 / b12670) into the A+B combine
danielhanchen Nov 24, 2026
540ca0a
tests : keep the banded test constructors as #378 has them, layout ca…
danielhanchen Nov 24, 2026
f90e567
metal : refuse banded attention with K/V cell and query positions
danielhanchen Nov 24, 2026
6600e1f
Merge #386 (ded02bdeb) into inkling2-metal-banded
danielhanchen Nov 24, 2026
c4e3077
ggml : keep the banded split handler of the meta backend as #378 has it
danielhanchen Nov 24, 2026
8ee7920
inkling : extend the banded code #378 carries instead of rewriting it…
danielhanchen Nov 24, 2026
01f7959
ggml : check the banded positions are mirrored outside the split hand…
danielhanchen Nov 24, 2026
c1b514d
metal : banded FA, read BF16 rel tables by bit shift
danielhanchen Nov 24, 2026
1fc707a
tests : banded FA, every Metal mixed K/V pair, head size 64 prefill, …
danielhanchen Nov 24, 2026
09df219
Merge #386 (01f79590f) into inkling2-metal-banded
danielhanchen Nov 24, 2026
2422de3
rpc : count GGML_OP_FLASH_ATTN_EXT_BANDED in the RPC op count
danielhanchen Nov 23, 2026
1f4e6d7
metal : banded and mixed K/V FA, admit only the layouts the launch ca…
danielhanchen Nov 24, 2026
577327c
metal : banded FA, keep padded keys out of the softmax
danielhanchen Nov 24, 2026
0ba299e
ggml : return the banded attention precision from ggml_prec_get_acc
danielhanchen Nov 24, 2026
d16c34d
tests : register test-flash-attn-bias and test-flash-attn-generic-has…
danielhanchen Nov 24, 2026
a75cc44
ggml-cuda : tag the banded MMA call with a negative m0 instead of max…
danielhanchen Nov 24, 2026
c43530b
ggml-cuda : honor GGML_CUDA_DISABLE_BANDED_MMA on the delegated FA MM…
danielhanchen Nov 24, 2026
9ce2297
ggml-cuda : write 0 for a fully masked row in the FA MMA kernel
danielhanchen Nov 24, 2026
3b5023b
convert : check the remote shards and tensor names like the local ones
danielhanchen Nov 24, 2026
aa3af57
convert : reject stacked ModelOpt NVFP4 experts before the pure NVFP4…
danielhanchen Nov 24, 2026
c766825
inkling : reserve the dense attention of multi-sequence ubatches and …
danielhanchen Nov 24, 2026
7a6f4de
inkling2 : reserve the dense graphs that run outside the banded reserve
danielhanchen Nov 24, 2026
073ad78
tests : banded FA at the F16 floor over a ragged n_kv, K/V layouts an…
danielhanchen Nov 24, 2026
4d7a835
ggml-cuda : do not delegate banded attention over unaligned F16 K/V rows
danielhanchen Nov 24, 2026
6249123
ggml-cuda : compile banded rel_logits paths out of non-banded FA head…
danielhanchen Nov 24, 2026
12db614
metal : FA, per-query sink loads for the banded op only
danielhanchen Nov 24, 2026
884b872
Merge #386 (6249123b1) into inkling2-metal-banded
danielhanchen Nov 24, 2026
5b3e29e
ggml-cuda : check GGML_CUDA_DISABLE_BANDED_MMA in its own statement, …
danielhanchen Nov 24, 2026
00b84c2
Merge #386 (5b3e29e29) into inkling2-metal-banded
danielhanchen Nov 24, 2026
a8ca6da
ggml-cuda : check GGML_CUDA_DISABLE_BANDED_MMA beside the other bande…
danielhanchen Nov 24, 2026
05caeeb
ggml : return the banded attention precision from ggml_prec_get_acc
danielhanchen Nov 24, 2026
82e03c6
tests : register test-flash-attn-bias and test-flash-attn-generic-has…
danielhanchen Nov 24, 2026
d8e01c2
ggml-cuda : tag the banded MMA call with a negative m0 instead of max…
danielhanchen Nov 24, 2026
b8d2bf7
ggml-cuda : write 0 for a fully masked row in the FA MMA kernel
danielhanchen Nov 24, 2026
734e786
convert : reject stacked ModelOpt NVFP4 experts before the pure NVFP4…
danielhanchen Nov 24, 2026
429cfdc
inkling : reserve the dense attention of multi-sequence ubatches and …
danielhanchen Nov 24, 2026
18f8fe1
ggml-cuda : do not delegate banded attention over unaligned F16 K/V rows
danielhanchen Nov 24, 2026
e1b2a33
ggml-cuda : compile banded rel_logits paths out of non-banded FA head…
danielhanchen Nov 24, 2026
df04d12
Merge #386 (a8ca6dab0) into inkling2-metal-banded
danielhanchen Nov 24, 2026
f44881a
ggml-metal : treat max_bias <= 0 as no ALiBi in flash attention
danielhanchen Nov 24, 2026
abcfe87
ggml-cuda : const_cast the banded F16 K/V view data instead of a C ca…
danielhanchen Nov 24, 2026
ba3ad42
Fix merge conflicts
danielhanchen Nov 24, 2026
0d1fd08
Fix merge conflicts
danielhanchen Nov 24, 2026
419b64e
Merge #386 (0d1fd082e) into inkling2-metal-banded
danielhanchen Nov 24, 2026
87d71c1
inkling2 : causal banded attention without a mask for a cache of one …
danielhanchen Nov 25, 2026
7d030e8
Merge the causal banded attention without a mask (CPU and CUDA) into …
danielhanchen Nov 25, 2026
0794913
metal : do not report the causal banded attention without a mask as s…
danielhanchen Nov 25, 2026
bb942f1
CUDA: banded MMA attention: load the quantized K/V tiles one step ahead
danielhanchen Nov 25, 2026
a744b4d
Merge the pipelined quantized K/V tile loads of the CUDA banded MMA a…
danielhanchen Nov 25, 2026
4c4e104
CUDA: banded MMA attention: dequantize the next K/V tile between the …
danielhanchen Nov 25, 2026
6a1f91e
Merge the interleaved quantized K/V tile dequantization of the CUDA b…
danielhanchen Nov 25, 2026
8686ca7
CUDA: banded MMA attention: load quantized K/V tiles ahead only at he…
danielhanchen Nov 25, 2026
e9e98b6
Merge the head size 128 gate of the banded MMA quantized tile loads i…
danielhanchen Nov 25, 2026
11830fe
CUDA: banded attention: refuse causal ops the kernels cannot run, ski…
danielhanchen Nov 25, 2026
7fd34f5
inkling2 : causal banded attention: positions for padded spans, cell …
danielhanchen Nov 25, 2026
5373aec
Merge the causal banded attention fixes (positions for padded spans, …
danielhanchen Nov 25, 2026
7280c5e
tests : causal banded attention over cell positions, and against an e…
danielhanchen Nov 25, 2026
97f7c62
metal : drop the unused mask local in the banded attention supports_op
danielhanchen Nov 26, 2026
a494afb
Fix merge conflicts
danielhanchen Nov 26, 2026
1a61200
Fix merge conflicts
danielhanchen Nov 26, 2026
22e0ced
Merge branch 'inkling2-attn-chunk' (1a61200bf) into inkling2-attn-banded
danielhanchen Nov 26, 2026
a9393c7
Merge #386 (22e0cedc7) into inkling2-metal-banded
danielhanchen Nov 26, 2026
762ef4d
inkling2 : reuse the graph of a causal padded span
danielhanchen Nov 26, 2026
0e98c94
Merge #386 (762ef4dc9) into inkling2-metal-banded
danielhanchen Nov 26, 2026
eb8e7c6
Fix merge conflicts
danielhanchen Nov 26, 2026
8607fae
Fix merge conflicts
danielhanchen Nov 26, 2026
0da65f1
Fix merge conflicts
danielhanchen Nov 26, 2026
c67efb2
Merge branch 'inkling2-attn-chunk' (8607fae0d) into inkling2-attn-banded
danielhanchen Nov 26, 2026
a17a355
Merge #386 (c67efb295) into inkling2-metal-banded
danielhanchen Nov 26, 2026
710aed3
CUDA: split the banded vec cells finer at a few queries
danielhanchen Nov 26, 2026
2ac33c2
Fix merge conflicts
danielhanchen Nov 26, 2026
d9d3315
Fix merge conflicts
danielhanchen Nov 26, 2026
a60d3a7
Merge #386 (2ac33c25c) into inkling2-metal-banded
danielhanchen Nov 26, 2026
e67909e
tests : run the padded F16 K layout cases on banded FA only (plain CU…
danielhanchen Nov 26, 2026
6c5046f
Merge #386 (e67909e25) into inkling2-metal-banded
danielhanchen Nov 26, 2026
b4671f4
Fix merge conflicts
danielhanchen Nov 26, 2026
6302e77
Merge #386 (b4671f408) into inkling2-metal-banded
danielhanchen Nov 26, 2026
b71fd1a
Inkling 2: build the log-scaled positions at their first use, so they…
danielhanchen Nov 27, 2026
c4748a8
Merge #386 (b71fd1ac0) into inkling2-metal-banded
danielhanchen Nov 27, 2026
57e6ec4
Fix merge conflicts
danielhanchen Nov 27, 2026
17826c8
ggml : accept the banded flash attention in the indexed-bias check, s…
danielhanchen Nov 27, 2026
8fe5d1e
Fix merge conflicts
danielhanchen Nov 27, 2026
40e1cc8
Merge #386 (8fe5d1efe)
danielhanchen Nov 27, 2026
731e35e
Inkling 2: keep 2 to 8 token ubatches on the dense attention with the…
danielhanchen Nov 28, 2026
7defeb2
Fix merge conflicts
danielhanchen Nov 28, 2026
ec3fe36
Fix merge conflicts
danielhanchen Nov 28, 2026
9d99858
Fix merge conflicts
danielhanchen Nov 28, 2026
8901e1c
Merge branch 'inkling2-attn-chunk' (ec3fe36ba) into inkling2-attn-banded
danielhanchen Nov 28, 2026
a141c70
Merge #386 (8901e1c37)
danielhanchen Nov 28, 2026
6f37a59
Merge branch 'dspark-verify-386' (710aed3cd) into inkling2-attn-banded
danielhanchen Nov 28, 2026
69920ac
Merge branch 'g1-pin386-small-dense' (731e35efb) into inkling2-attn-b…
danielhanchen Nov 28, 2026
1db2349
Merge #386 (69920aca0) into inkling2-metal-banded
danielhanchen Nov 28, 2026
bfd2f0e
Fix merge conflicts
danielhanchen Nov 28, 2026
3a43518
Merge #386 (bfd2f0e38) into inkling2-metal-banded
danielhanchen Nov 28, 2026
cd78840
inkling2 : dense few-token attention by default on CUDA only
danielhanchen Nov 29, 2026
7d8bcdf
Merge #386 (cd7884027) into inkling2-metal-banded
danielhanchen Nov 30, 2026
13b53cf
Fix merge conflicts
danielhanchen Dec 1, 2026
81d72fc
Fix merge conflicts
danielhanchen Dec 1, 2026
7156c24
Fix merge conflicts
danielhanchen Dec 1, 2026
48f3ae2
Merge branch 'inkling2-attn-chunk' (81d72fc72) into inkling2-attn-banded
danielhanchen Dec 1, 2026
2b16115
Merge #386 (48f3ae214) into inkling2-metal-banded
danielhanchen Dec 1, 2026
eacd17d
inkling : keep the dense relative bias in F32 on the non-FA attention…
danielhanchen Dec 1, 2026
f475657
Merge branch 'inkling1-b12533' (eacd17dfc) into inkling2-attn-banded
danielhanchen Dec 1, 2026
d257c98
Merge #386 (f475657fd) into inkling2-metal-banded
danielhanchen Dec 1, 2026
874f2ae
inkling : keep the 8-wide MoE router soft_max on the CUDA block kernel
danielhanchen Dec 1, 2026
9dd84c2
inkling : also keep the router soft_max off the short-row kernel on R…
danielhanchen Dec 2, 2026
4a8e8b9
inkling : keep the router soft_max on the Metal kernel it used before…
danielhanchen Dec 2, 2026
4f4442d
Fix merge conflicts
danielhanchen Dec 3, 2026
b632cf4
Fix merge conflicts
danielhanchen Dec 3, 2026
8793947
Merge branch 'inkling1-b12533' (4f4442d5f) into inkling2-attn-banded
danielhanchen Dec 3, 2026
149f91f
Fix merge conflicts
danielhanchen Dec 3, 2026
9e889f9
Merge #386 (879394754) into inkling2-metal-banded
danielhanchen Dec 3, 2026
b699fb7
inkling2 : use ggml_flash_attn_ext_set_sinks instead of the deprecate…
danielhanchen Dec 3, 2026
1867932
Merge commit 'b699fb7018112b25db4dacebad15e0ba57740e94' into pinfix/431
danielhanchen Dec 3, 2026
551bc36
tests : use ggml_flash_attn_ext_set_sinks instead of the deprecated a…
danielhanchen Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"HYV4ForCausalLM": "hy_v4",
"HYV4FlashForCausalLM": "hy_v4_flash",
"IQuestCoderForCausalLM": "llama",
"InklingForConditionalGeneration": "inkling",
"Inkling2ForCausalLM": "inkling2",
"Inkling2LoopForCausalLM": "inkling2",
"Inkling2ForConditionalGeneration": "inkling2",
Expand Down Expand Up @@ -401,6 +402,7 @@
"HYV4FlashForCausalLM": "hy_v4_flash",
"HYV4FlashForConditionalGeneration": "hy_v4_flash",
"Idefics3ForConditionalGeneration": "smolvlm",
"InklingForConditionalGeneration": "inkling",
"Inkling2ForConditionalGeneration": "inkling2",
"Inkling2LoopForConditionalGeneration": "inkling2",
"InternVisionModel": "internvl",
Expand Down
35 changes: 35 additions & 0 deletions conversion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
self._source_tensor_names[name] = titem[0] if titem else None
if titem:
tname, tgen = titem
if tname in tensors:
raise ValueError(
f"duplicate tensor '{tname}' found in the remote model; "
f"refusing to silently overwrite")
tensors[tname] = tgen

return tensors
Expand Down Expand Up @@ -306,10 +310,19 @@
data_gen = lambda data=data_torch: LazyTorchTensor.from_eager(data) # noqa: E731
else:
data_gen = lambda data=data_torch: data # noqa: E731
# the index maps each tensor to one shard; a duplicate would silently overwrite it
if weight_map and name in weight_map and weight_map[name] != part_name:
raise ValueError(
f"tensor '{name}' found in '{part_name}' but the index assigns "
f"it to '{weight_map[name]}'; refusing to load a wrong-shard copy")
titem = self.filter_tensors((name, data_gen))
self._source_tensor_names[name] = titem[0] if titem else None
if titem:
tname, tgen = titem
if tname in tensors:
raise ValueError(
f"duplicate tensor '{tname}' found in multiple model parts; "
f"refusing to silently overwrite")
tensors[tname] = tgen

# verify tensor name presence and identify potentially missing files
Expand Down Expand Up @@ -375,6 +388,20 @@
self.gguf_writer.add_tensor(new_name, scale.flatten().numpy())

def dequant_model(self):
# stacked-expert NVFP4 (w13_weight/w2_weight) is silently skipped by the NVFP4 repack and the dequant below
quant_config = self.hparams.get("quantization_config")
if isinstance(quant_config, dict) and quant_config.get("quant_method") in ("modelopt", "modelopt_mixed"):
stacked_expert_aux = [
n for n in self.model_tensors
if n.endswith((".scale2", ".input_amax", ".original_shape"))
]
if stacked_expert_aux:
raise NotImplementedError(
"This checkpoint stores quantized experts in the stacked ModelOpt NVFP4 layout "
f"({len(stacked_expert_aux)} auxiliary tensors like {stacked_expert_aux[0]!r}), "
"which is not supported yet. Convert from the unquantized (BF16) checkpoint instead."
)

# If all quantized tensors were already handled (e.g. pure NVFP4), skip
if self._is_nvfp4 and not any(k.endswith((".weight_scale", ".weight_scale_inv", ".input_scale", ".activation_scale", "_activation_scale", ".k_scale", ".v_scale")) for k in self.model_tensors):
return
Expand Down Expand Up @@ -1803,6 +1830,14 @@
self.prepare_tensors()
if (self.ple_only or self.no_ple) and not self._has_ple:
raise ValueError("model has no per-layer embedding table to export separately")
# zero tensors means the shards were never discovered, yet a metadata-only GGUF logs success
n_written = sum(len(shard) for shard in self.gguf_writer.tensors)
if n_written == 0:
raise ValueError(
"no tensors were written: the model shards could not be found. "
"Check that the safetensors filenames are discoverable (they must "
"start with 'model') or that model.safetensors exists."
)
self.prepare_metadata(vocab_only=False)
self.gguf_writer.write_header_to_file(path=self.fname_out)
self.gguf_writer.write_kv_data_to_file()
Expand Down Expand Up @@ -2194,7 +2229,7 @@
# To avoid unexpected issues - we make sure to normalize non-normalized tokens
if not added_tokens_decoder[i].normalized:
previous_token = token
token = tokenizer.decode(tokenizer.encode(token, add_special_tokens=False)) # ty: ignore[invalid-assignment]

Check warning on line 2232 in conversion/base.py

View workflow job for this annotation

GitHub Actions / python type-check

ty (unused-ignore-comment)

conversion/base.py:2232:102: unused-ignore-comment: Unused `ty: ignore` directive help: Remove the unused suppression comment
if previous_token != token:
logger.info(f"{repr(previous_token)} is encoded and decoded back to {repr(token)} using AutoTokenizer")

Expand Down Expand Up @@ -3056,7 +3091,7 @@
# To avoid unexpected issues - we make sure to normalize non-normalized tokens
if not added_tokens_decoder[i].normalized:
previous_token = token
token = tokenizer.decode(tokenizer.encode(token, add_special_tokens=False)) # ty: ignore[invalid-assignment]

Check warning on line 3094 in conversion/base.py

View workflow job for this annotation

GitHub Actions / python type-check

ty (unused-ignore-comment)

conversion/base.py:3094:102: unused-ignore-comment: Unused `ty: ignore` directive help: Remove the unused suppression comment
if previous_token != token:
logger.info(f"{repr(previous_token)} is encoded and decoded back to {repr(token)} using AutoTokenizer")

Expand Down
Loading
Loading