Skip to main content

assert_every_tensor_consumed

Function assert_every_tensor_consumed 

Source
pub fn assert_every_tensor_consumed(file: &ShardedGguf) -> Result<(), LoadError>
Expand description

Fails the load when the checkpoint carries tensors this build never looked at.

A tensor nobody reads is not a harmless extra: it is a term of the real graph that ours is missing. gpt-oss ships blk.N.attn_sinks and ferrox has no attention-sink code anywhere, so the file loads, runs at full speed, and emits a different distribution than the model it claims to be; the newer MoE recipes ship ffn_exp_probs_b the same way. Both are silent today, and both are exactly what the architecture registry cannot catch, because the architecture string is one ferrox does support — it is the checkpoint that carries more than the registry entry promises.

This is deliberately the last check in the load: by here every loader arm has had its chance to ask for what it needs, so what is left over is what nothing in this build knows about.

FERROX_ALLOW_UNKNOWN_TENSORS=1 downgrades it to a warning, for the case where a human has decided the missing term does not matter (a bias tensor of zeros, an auxiliary head that never runs). The default is refusal: a wrong answer is worse than no answer.