Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
inkling2: bf16 experts, vision kept on convert, processor registry
- sanitize: unquantized (bf16) w13/w2 experts load as they are; only
  uint8 tensors are packed NVFP4 / MXFP8.
- save_config keeps vision_config for inkling2 / inkling2_loop.
- load_processor(config) as upstream, by model package; inkling2 added.
  Nothing called the old load_processor(model, config).

The cache, batch and loop tests failed only under TF32 (M5 default);
with MLX_ENABLE_TF32=0 all eight pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • Loading branch information
Roman Romenskyi and claude committed Nov 22, 2026
commit 9451e775dfd7c416b9085ed0622bc523c44a0017
5 changes: 4 additions & 1 deletion mlx_lm/models/inkling2/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ def sanitize(model, weights: dict[str, mx.array]) -> dict[str, mx.array]:
denominator[name] = v
elif suffix == "_scale":
sanitized[f"{name}.scales"] = v
else:
elif v.dtype == mx.uint8:
sanitized[f"{name}.weight"] = v.view(mx.uint32)
else:
# Unquantized experts.
sanitized[f"{name}.weight"] = v
continue
sanitized[k] = v

Expand Down
11 changes: 6 additions & 5 deletions mlx_lm/processors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

"""Image processors of multimodal models, one module per model."""

from mlx import nn
from mlx_lm.models.inkling2 import processor as inkling2
from mlx_lm.utils import model_package

from . import muse_spark

# The processor of each model module.
# The processor of each model package.
PROCESSORS = {
"inkling2": inkling2.Processor,
"muse_spark": muse_spark.Processor,
}


def load_processor(model: nn.Module, config: dict) -> muse_spark.Processor | None:
def load_processor(config: dict):
"""The processor of a model, or None."""
if not config.get("vision_config"):
return None
model_module = type(model).__module__.rsplit(".", 1)[-1]
name = config.get("processor_type", model_module)
name = config.get("processor_type", model_package(config))
processor = PROCESSORS.get(name)
return processor.from_config(config) if processor else None
2 changes: 2 additions & 0 deletions mlx_lm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,8 @@ def save_config(
"lfm2_vl",
"lfm2-vl",
"muse_spark",
"inkling2",
"inkling2_loop",
):
config.pop("vision_config", None)
if "quantization" in config:
Expand Down