Module factory

Module factory 

Source
Expand description

Model factory: builds the right model from config + weights.

Weight loader selection is registry-driven — add new models by implementing ModelWeightLoader and registering in loader_for_config. No other code changes needed.

Structs§

DflashBuildArgs
DFlash speculative-decoding build arguments. None for non-DFlash runs; Some(...) carries the drafter’s separate WeightStore, parsed config.json, and CLI overrides for γ and the sliding-window size.
LoraBuildArgs
LoRA adapter build arguments (--lora-adapter NAME=PATH). None for base-only runs; Some(...) carries the adapter’s separate on-device WeightStore (loaded via spark_runtime::weights::adapter::load_adapter_safetensors), the parsed adapter_config.json, and the pool-shape CLI knobs.

Functions§

build_model
loader_for_config
Select the weight loader for a given model config.