Skip to main content

Module write

Module write 

Source
Expand description

Writing .safetensors output. teeny-data::safetensors only supports mmap’d reading, so this writes directly via the safetensors crate rather than extending that (leaf) crate – see teenygrad-303.2.

Structs§

OutputTensor
One tensor to be written: its dtype, shape, and raw little-endian bytes (already in whatever on-disk representation dtype implies – e.g. packed U8 nibbles for INT4).

Functions§

serialize_safetensors
Serializes tensors plus metadata (embedded as the file’s string-keyed __metadata__ header – e.g. the quantization_config JSON blob, see crate::format) to an in-memory .safetensors byte buffer.
write_safetensors
Serializes tensors/metadata (see serialize_safetensors) directly to a .safetensors file at path.