Package-level declarations

Types

Link copied to clipboard
data class GgufExportOptions(val metadataOnly: Boolean = false, val graphFormatVersion: Int = 1, val defaultDtype: String? = "FP32", val generalMetadata: Map<String, Any> = emptyMap(), val provenance: Map<String, Any> = emptyMap())

Options for preparing a GGUF export.

Link copied to clipboard
data class GgufTensorEntry(val ggufName: String, val tensor: Tensor<*, *>, val quantization: GGMLQuantizationType, val shape: List<Int>)

Tensor entry to be consumed by a future GGUF writer implementation.

Link copied to clipboard
data class GGUFWriteOptions(val alignment: Int = GGUF_DEFAULT_ALIGNMENT)

Options for writing GGUF bytes.

Link copied to clipboard
object GGUFWriter

Minimal GGUF writer that consumes a GgufWriteRequest and emits GGUF v3 bytes. Scope: supports scalar KV types (string/int/long/float/bool) and flat arrays of those scalars; tensor payloads support FP32, FP16, BF16, F64, Int8/Int16/Int32/Int64 plus raw-byte passthrough for other quantization tags.

Link copied to clipboard
data class GGUFWriteReport(val bytesWritten: Long, val tensorCount: Int, val kvCount: Int)

Result summary for a GGUF write.

Link copied to clipboard
data class GgufWriteRequest(val metadata: Map<String, Any>, val tensors: List<GgufTensorEntry>, val tensorMap: Map<String, String>)

Aggregate export payload prepared by the facade; writer will consume this.

Functions

Link copied to clipboard
fun collectParameters(model: Module<*, *>, prefix: String = model.name): Map<String, Tensor<*, *>>

Recursively collect parameters from a Module tree using a stable path-based naming scheme.

Link copied to clipboard
fun exportGraphToGguf(graph: ComputeGraph, weights: Map<String, Tensor<*, *>>, label: String = "graph", options: GgufExportOptions = GgufExportOptions()): GgufWriteRequest

Prepare a GGUF write request from a compute graph and weight tensors. This does not write bytes; a future GGUFWriter will consume the request.

Link copied to clipboard
fun exportModelToGguf(model: Module<*, *>, forwardPass: (GraphExecutionContext) -> Unit, label: String = model.name, options: GgufExportOptions = GgufExportOptions(), baseOps: TensorOps = VoidTensorOps()): GgufWriteRequest

Convenience: record a forward pass under a graph/tape context, collect weights, and prepare a GGUF request. The forwardPass lambda receives a GraphExecutionContext whose ops are tracing-enabled (VoidTensorOps base).

Link copied to clipboard
fun exportTapeToGguf(tape: ExecutionTape?, weights: Map<String, Tensor<*, *>>, label: String = "graph", options: GgufExportOptions = GgufExportOptions()): GgufWriteRequest

Build a GGUF export request starting from an ExecutionTape (if present). Falls back to an empty graph when no tape is supplied.

Link copied to clipboard
fun writeGraphToGgufBytes(graph: ComputeGraph, weights: Map<String, Tensor<*, *>>, label: String = "graph", options: GgufExportOptions = GgufExportOptions()): Pair<GGUFWriteReport, ByteArray>

Convenience: prepare and write GGUF bytes directly for a graph + weights.

Link copied to clipboard
fun writeGraphToGgufFile(file: File, graph: ComputeGraph, weights: Map<String, Tensor<*, *>>, label: String = file.nameWithoutExtension, options: GgufExportOptions = GgufExportOptions()): GGUFWriteReport

Write GGUF bytes for a graph + weights directly to a file on JVM.

Link copied to clipboard
fun writeModelToGgufBytes(model: Module<*, *>, forwardPass: (GraphExecutionContext) -> Unit, label: String = model.name, options: GgufExportOptions = GgufExportOptions(), baseOps: TensorOps = VoidTensorOps()): Pair<GGUFWriteReport, ByteArray>

Convenience: prepare and write GGUF bytes directly for a model + forward pass.

Link copied to clipboard
fun writeModelToGgufFile(file: File, model: Module<*, *>, forwardPass: (GraphExecutionContext) -> Unit, label: String = file.nameWithoutExtension, options: GgufExportOptions = GgufExportOptions()): GGUFWriteReport

Write GGUF bytes for a model + forward pass directly to a file on JVM.