GgufModelParser
GGUF model parser extending BaseModelParser. Provides metadata-first parsing of GGUF model files using SKaiNET's GGUF I/O capabilities.
This implementation supports two modes:
Streaming mode (JVM): Uses RandomAccessSource for memory-efficient parsing. Only metadata is loaded (~1 MB), tensors loaded on-demand via loadTensorData.
Legacy mode (JS/Native): Falls back to GGUFReader which loads full file.
Usage:
val parser = GgufModelParser()
parser.parseMetadata("model.gguf")
// Check if streaming mode is available
if (parser.isStreamingMode) {
// Load specific tensor on demand
val data = parser.loadTensorData("model.embed_tokens.weight")
}
// Always close when done
parser.close()Content copied to clipboard