Skip to main content

Module safetensors_io

Module safetensors_io 

Source
Expand description

Safetensors checkpoint loading, binary unpacking, packed saving, and header inspection.

Structs§

CheckpointStats
Summary statistics for a LittleBit checkpoint directory.
LayerInspection
Per-layer metadata extracted from a LittleBit checkpoint.
LoadedStateDict
Unpacked checkpoint tensors alongside detected format metadata.
SafetensorsReader
Safe streaming safetensors reader that parses headers once and seeks to load individual tensors or 3D dimension-0 slices on demand using zero unsafe code.
ShardedSafetensorsWriter
Incremental sharded safetensors writer that flushes completed shards to disk and frees their in-memory buffers as quantization progresses.
TensorLocation
Location metadata for a single tensor inside a safetensors shard on disk.

Enums§

CheckpointFormat
Detected checkpoint storage format.

Functions§

inspect_checkpoint
Inspect a local LittleBit checkpoint without loading full weight tensors into memory.
load_and_unpack_state_dict
Load a checkpoint directory and automatically unpack *_packed/*_shape tensors into target_dtype float tensors matching upstream _load_and_process_state_dict.
load_raw_safetensors_dir
Load all raw safetensors tensors from a checkpoint directory (single file or sharded index).
save_packed_safetensors
Save a state dictionary to dir/model.safetensors and write dir/model.safetensors.index.json.