find_gguf_shards

Function find_gguf_shards 

Source
pub fn find_gguf_shards(first: &Path) -> Result<GgufShardSet>
Expand description

Resolve every shard of a split GGUF, given the first one.

WHY THIS IS NOT “glob the directory”: a directory can legitimately hold more than one model, an in-progress download, or a leftover shard from a different quant. The split keys are the only authority on what belongs to this file set, so the count comes from split.count and membership is checked per shard rather than assumed from the filename.

Refuses, rather than proceeding, when:

  • the passed file is not split.no == 0 (the caller resolved the wrong one)
  • any sibling named by the convention is missing or unparseable
  • a sibling disagrees about split.count or split.tensors.count
  • the split.no values are not exactly 0..count
  • the per-shard tensor counts do not sum to split.tensors.count

That last check is the one that matters in practice: a download that lost a shard still leaves every other shard individually valid and checksum-clean, so nothing below the tensor-count sum catches it.