Expand description
Format-agnostic checkpoint loading.
Supported inputs (detected by extension, with a magic-byte fallback):
.safetensors— single file or several shard filesmodel.safetensors.index.json— HF sharded-model index (shards resolved relative to the index file).pt/.pth/.bin/.ckpt— PyTorch pickle checkpoints (zip-basedtorch.saveformat) via candle’s pickle reader.npy/.npz— NumPy arrays.gguf— existing GGUF files (tensors dequantized to F32; metadata carried through), which makes dtype re-quantization possible
Every tensor is returned as raw little-endian bytes plus a SrcDtype
(F32/F16/BF16 preserved exactly; other dtypes — F64, integers — are cast to
F32 with a warning).
Structs§
- Checkpoint
- A loaded checkpoint: all tensors plus any metadata carried over from the source (only GGUF inputs have metadata).
- Load
Options - RawTensor
- One tensor read from a checkpoint: name, row-major (python-order) shape, source dtype, and raw little-endian bytes.
Functions§
- load_
checkpoint - Load one or more checkpoint files into a single
Checkpoint. Multiple inputs (e.g. safetensors shards) are merged; duplicate tensor names across inputs are an error.