is_ngram_table

Function is_ngram_table 

Source
pub fn is_ngram_table(name: &str) -> bool
Expand description

Whether a tensor is an n-gram embedding TABLE — the huge blobs that are served off NVMe instead of being uploaded with the rest of the checkpoint.

TWO NAMING FAMILIES, because two model families ship this mechanism:

LongCat-Flash-Lite *.ngram_embeddings.embedders.{i}.weight 12 tables, ~5.2 GB each Qwen3.8-Flash-Next *.ple.ple_embedding.ngram_embedding.shard_{i}.weight 128 shards of one logical table, 47.7 GB (FP8) to 95.4 GB (BF16) in total

Matching is by TENSOR NAME rather than by file, deliberately: RadixArk isolates the Qwen shards in dedicated model-plefp8-* files, but Inferact buries all 128 inside one 95.4 GB model-00001-of-00004.safetensors. A filename rule would work for one release and silently fail the other, where “silently” means a 221 GB OOM pre-flight on a 121 GB box.

What must NOT match, because the loader needs these resident:

  • LongCat’s small post_projs
  • Qwen’s ngram_embedding.weight_scale (one BF16 scalar)
  • Qwen’s ngram_heads_offsets / ngram_heads_vocab_sizes (I64, 16 each)