Package-level declarations

Types

Link copied to clipboard
data class FieldParts(val size: Int, val parts: List<List<Any>>, val idxs: List<Int>, val types: List<GGUFValueType>)
Link copied to clipboard

GGML quantization types.

Link copied to clipboard
data class GgufModelMetadata(val architecture: String?, val name: String?, val author: String?, val license: String?, val version: String?, val url: String?, val classNames: List<String>?, val numClasses: Int?, val inputSize: Int?, val contextLength: Int?, val embeddingLength: Int?, val headCount: Int?, val layerCount: Int?, val vocabSize: Int?, val tokenizerModel: String? = null, val tokenizerTokens: List<String>? = null, val tokenizerMerges: List<String>? = null, val tokenizerTokenTypes: List<Int>? = null, val bosTokenId: Int? = null, val eosTokenId: Int? = null, val rawFields: Map<String, Any?>)

Parsed model metadata from a GGUF file.

Link copied to clipboard

GGUF model parser extending BaseModelParser. Provides metadata-first parsing of GGUF model files using SKaiNET's GGUF I/O capabilities.

Link copied to clipboard
Link copied to clipboard
class GgufParametersLoader(sourceProvider: () -> Source, onProgress: (current: Long, total: Long, message: String?) -> Unit = { _, _, _ -> }) : ParametersLoader

ParametersLoader implementation backed by the legacy GGUFReader.

Link copied to clipboard
class GGUFReader(source: Source, loadTensorData: Boolean = true, decodeF16ToFloat: Boolean = true, decodeBF16ToFloat: Boolean = true)
Link copied to clipboard
Link copied to clipboard
data class ReaderField(val offset: Int, val name: String, val parts: List<List<Any>> = emptyList(), val data: List<Int> = listOf(-1), val types: List<GGUFValueType> = emptyList())
Link copied to clipboard
data class ReaderTensor(val name: String, val tensorType: GGMLQuantizationType, val rawTypeValue: Int, val shape: List<UInt>, val nElements: Int, val nBytes: Int, val dataOffset: Int, val data: List<Any>, val field: ReaderField)
Link copied to clipboard
class StreamingGgufParametersLoader(sourceProvider: () -> RandomAccessSource, onProgress: (current: Long, total: Long, message: String?) -> Unit = { _, _, _ -> }) : ParametersLoader

Streaming GGUF parameters loader — the recommended path for loading GGUF models.

Link copied to clipboard

Streaming GGUF reader that parses metadata without loading the entire file.

Link copied to clipboard
data class StreamingTensorInfo(val name: String, val shape: List<UInt>, val tensorType: GGMLQuantizationType, val rawTypeValue: Int, val nElements: Long, val nBytes: Long, val relativeOffset: Long, var absoluteDataOffset: Long)

Tensor metadata for streaming access.

Link copied to clipboard

Abstracts the mapping from logical tensor roles to GGUF tensor name strings.

Properties

Link copied to clipboard
const val GGUF_DEFAULT_ALIGNMENT: Int = 32
Link copied to clipboard
const val GGUF_MAGIC: UInt

This is a kotlin gguf reader related logic interpreted from python code "gguf-py/gguf/constants.py" of github repo "https://github.com/ggerganov/llama.cpp"

Link copied to clipboard
const val GGUF_VERSION: Int = 3
Link copied to clipboard
const val QK_K: Int = 256
Link copied to clipboard

This is a kotlin gguf reader interpreted from python code "gguf-py/gguf/gguf_reader.py" of github repo "https://github.com/ggerganov/llama.cpp"

Functions

Link copied to clipboard

Convert a physical byte shape back to a logical element shape.

Link copied to clipboard

Android implementation of createRandomAccessSource.

Platform-specific factory for creating RandomAccessSource instances.

JS implementation of createRandomAccessSource.

JVM implementation of createRandomAccessSource.

Native implementation of createRandomAccessSource.

WasmJS implementation of createRandomAccessSource.

WasmWASI implementation of createRandomAccessSource.

Link copied to clipboard

Check whether a quantization type uses block quantization (vs element-wise).

Link copied to clipboard

Get the block size for a quantization type.

Link copied to clipboard
fun quantByteSize(elementCount: ULong, quantType: GGMLQuantizationType): ULong

Compute the total byte size for a quantized tensor.

Link copied to clipboard

Compute the total number of logical elements from a shape.

Link copied to clipboard

Convert a logical element shape to a physical byte shape for quantized storage.

Link copied to clipboard

Get the byte size per block for a quantization type.

Link copied to clipboard
fun validateQuantizedBytes(bytes: ByteArray, elementCount: ULong, quantType: GGMLQuantizationType)

Validate that a byte array has the correct size for a given quantized tensor.