build_from_gguf()¶
Build an ONNX ModelPackage directly from GGUF metadata and tensors without
tracing PyTorch.
GGUF support is capability-specific: metadata parsing, tensor mapping, graph construction, quantized storage, tokenizer materialization, and runtime validation have independent verdicts. A successful graph import does not by itself mean that runtime packaging is validated. See the GGUF capability and evidence catalog for exhaustive, generated verdicts and immutable evidence.
Python usage¶
from mobius import build_from_gguf
package = build_from_gguf("model.gguf")
package.save("output")
Quantized target storage is requested by default. Use
keep_quantized=False when the output must use float storage.
Signature¶
def build_from_gguf(
gguf_path: str | Path,
*,
task: str | ModelTask | None = None,
dtype: str | None = None,
keep_quantized: bool = True,
execution_provider: str = "default",
mmproj: str | Path | None = None,
image_token_id: int | None = None,
static_cache: bool = False,
max_seq_len: int | None = None,
allow_dense_moe: bool | None = None,
reuse_gguf_weights: bool = False,
target_config: str | Path | Mapping[str, object] | None = None,
output_layer_indices: Sequence[int] | None = None,
) -> ModelPackage:
Parameter |
Description |
|---|---|
|
GGUF model path. |
|
Optional task override; otherwise selected from GGUF architecture metadata. |
|
Target float dtype, such as |
|
Request quantized target storage where the selected graph and qtype route support it. This does not promise source-byte or numerical fidelity. |
|
Target EP for EP-aware graph optimization; |
|
Companion projector GGUF for a registry-evidenced multimodal route. |
|
Processor-owned image placeholder ID for an |
|
Request a fixed-width KV cache and optionally set its length. |
|
Opt in to a dense fallback for supported MoE imports. |
|
Reuse compatible source tensor byte ranges in the saved package. |
|
Exact target configuration for a supported speculative draft model. |
|
Optional hidden-layer outputs to expose. |
CLI usage¶
mobius build-gguf GGUF_PATH --output OUTPUT_DIR [options]
# Quantized target storage where supported
mobius build-gguf model.gguf --output output/
# Explicit float storage
mobius build-gguf model.gguf --output output-float/ --dequantize
Key options:
Option |
Purpose |
|---|---|
|
Store all mapped weights as float instead of requesting quantized target storage. |
|
Set the target float dtype. |
|
Select EP-aware optimization; use |
|
Build an evidenced multimodal package with a companion projector. |
|
Request runtime-specific metadata and tokenizer packaging. |
|
Record the selected runtime version for exact evidence matching. |
|
Build a fixed-width cache; |
|
Build a supported DFlash/EAGLE3 target-draft pair. |
|
Reuse compatible source tensor byte ranges directly from the GGUF; converted weights are written to |
|
Select and size external weight storage. |
|
Strip build-only debug and provenance metadata. |
See the complete CLI reference for all options and compatibility constraints.
Output and status behavior¶
The Python API returns a ModelPackage; the CLI saves it to --output. Saved GGUF
packages record conversion fidelity in quantization_report.json. Runtime packaging
also records component dispositions in export_report.json and compatibility status
in runtime_compatibility.json.
export_status describes whether requested package components were emitted.
runtime_validation_status independently reports whether the exact artifact,
tokenizer, runtime version, and final package bytes match structured evidence.
unvalidated is not a claim that the graph is invalid.
Fail-closed outcomes¶
Unsupported architecture semantics, tensor mappings, malformed or corrupt input, and source-identity mismatches fail before durable output.
A quantized tensor without a supported import route fails instead of silently becoming float; use
--dequantizeorkeep_quantized=Falsewhen appropriate.An authoritative tokenizer blocker preserves a valid model export, emits a structured warning, omits unverified tokenizer assets, and records a partial component disposition in
export_report.json.Missing exact runtime evidence preserves an accurate model package with
runtime_validation_status: unvalidated; it does not upgrade the package to a validated runtime claim.
In the generated catalog, SUPPORTED means the named capability is implemented and
mechanically tested, DEFERRED means it is intentionally unavailable pending the
stated work, and REJECTED means the input or route is invalid by policy.