SafetensorsExporter class

Utility class for serializing and exporting GPUTensor weights into the Hugging Face Safetensors binary format. Handles flattening nested lists, pulling buffers from VRAM to CPU, converting values to 32-bit floats, and writing the 8-byte length prefix, JSON metadata header, and raw data buffer.

Constructors

SafetensorsExporter()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

saveModel(Map<String, GPUTensor> modelTensors, String outputPath) → void
Exports a map of GPUTensor instances to disk at outputPath adhering to the Hugging Face Safetensors format. Pulls tensor data from VRAM to CPU, flattens dimensions, packs the data into little-endian Float32 byte buffers, constructs the JSON metadata header, and writes the complete binary file with an 8-byte little-endian header length prefix.