SafeTensorsParametersLoader
class SafeTensorsParametersLoader(sourceProvider: () -> RandomAccessSource, onProgress: (current: Long, total: Long, message: String?) -> Unit = { _, _, _ -> }) : ParametersLoader(source)
ParametersLoader implementation for SafeTensors format using streaming.
Uses StreamingSafeTensorsReader for memory-efficient loading - only parses the header (~1KB-1MB) and loads tensors on-demand.
Supported conversions:
F32/F64 tensors -> FP32 (F64 downcast with warning)
I32/I64 tensors -> Int32 (I64 downcast with warning)
I8/U8 tensors -> Int8
F16/BF16 tensors -> FP32 (with dequantization)
Parameters
sourceProvider
Factory providing RandomAccessSource to the SafeTensors file
onProgress
Optional progress callback (current, total, tensorName)
Constructors
Link copied to clipboard
constructor(sourceProvider: () -> RandomAccessSource, onProgress: (current: Long, total: Long, message: String?) -> Unit = { _, _, _ -> })