mlx.AdapterFuser
Fuses a shipped LoRA adapter into a base MLX model.
Usage
mlx.AdapterFuser()The fused model is stored in the Hugging Face hub cache using the standard models--*/snapshots/* layout, keyed by the codec’s digest, so repeat calls reuse the cached result.
Methods
| Name | Description |
|---|---|
| ensure_fused() |
Fuse the codec’s adapter into model_repo, returning the cached result when present.
|
ensure_fused()
Fuse the codec’s adapter into model_repo, returning the cached result when present.
Usage
ensure_fused(model_repo, *, codec, cache_namespace, tqdm_class=None)On a cache miss, downloads the base model from the Hugging Face hub, decodes the compressed adapter, applies and fuses the LoRA layers, and saves the merged model into the hub cache.
Parameters
model_repo: str-
Hugging Face repo id of the base MLX model.
codec: AdapterCodec-
Codec providing the compressed adapter and its config.
cache_namespace: str-
Names the cache entry
models--{cache_namespace}-{digest}. tqdm_class: type | None = None-
Progress-bar class forwarded to
snapshot_download.
Returns
Path- Path to the fused model’s snapshot directory.