Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions mlx_lm/models/mistral3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import mlx.nn as nn
from mlx.utils import tree_flatten, tree_unflatten

from . import llama, ministral3
from . import llama, ministral3, mistral4
from .base import BaseModelArgs


Expand All @@ -26,7 +26,14 @@ def __init__(self, args: ModelArgs):
super().__init__()
self.args = args
self.model_type = args.model_type
if args.text_config.get("model_type") == "ministral3":
# Route based on architecture structure, not model_type string.
# MoE models (Mistral Small 4) have n_routed_experts in config.
# Dense models (Ministral 3B/8B/14B) use ministral3 or llama paths.
if args.text_config.get("n_routed_experts") is not None:
self.language_model = mistral4.Model(
mistral4.ModelArgs.from_dict(args.text_config)
)
elif args.text_config.get("model_type") == "ministral3":
self.language_model = ministral3.Model(
ministral3.ModelArgs.from_dict(args.text_config)
)
Expand Down
Loading