Skip to main content

Module read

Module read 

Source
Expand description

Reading source .safetensors checkpoints. Opening/mmapping is delegated to teeny_data::safetensors::SafeTensors; this module only adds the “upcast whatever float dtype is on disk to f32 for quantization math” step.

Functions§

is_quantizable_float
Whether dtype is one read_f32 can upcast from.
read_f32
Reads view’s raw bytes as f32, upcasting from F32/F16/BF16 as needed. Integer or boolean source tensors (already-quantized inputs, masks, etc.) aren’t supported – callers should pass those through unquantized rather than routing them through this function.
read_metadata
Reads a .safetensors file’s __metadata__ string map (e.g. the embedded quantization_config – see crate::format) directly from path.