exo-explore/exo · error · ValueError
Could not find inner transformer (embed_tokens) in {type(mod
Error message
Could not find inner transformer (embed_tokens) in {type(model).__name__}. Add a new pattern to _get_inner_model() for this architecture. What it means
Error "Could not find inner transformer (embed_tokens) in {type(model).__name__}. Add a new pattern to _get_inner_model() for this architecture." thrown in exo-explore/exo.
Source
Thrown at src/exo/worker/engines/mlx/vision.py:635
image_features = hidden_states
# `create_vision_embeddings` expects a 2D (total_tokens, hidden) view,
# but fixed-token-budget models (gemma4) return (n_images, tokens, hidden).
if image_features.ndim == 3:
image_features = image_features.reshape(-1, image_features.shape[-1])
return image_features, n_tokens_per_image
def get_inner_model(model: nn.Module) -> Any: # type: ignore
for candidate in (
getattr(model, "model", None),
getattr(getattr(model, "language_model", None), "model", None),
):
if candidate is not None and hasattr(candidate, "embed_tokens"): # type: ignore
return candidate # type: ignore
raise ValueError(
f"Could not find inner transformer (embed_tokens) in {type(model).__name__}. "
"Add a new pattern to _get_inner_model() for this architecture."
)
def create_vision_embeddings(
model: Model,
prompt_tokens: mx.array,
image_features: mx.array,
image_token_id: int,
) -> mx.array:
inner = get_inner_model(model) # type: ignore
embed_tokens = inner.embed_tokens # type: ignore
input_embeddings: mx.array = embed_tokens(prompt_tokens[None]) # type: ignore
is_image: mx.array = mx.equal(prompt_tokens, image_token_id)
n_placeholders = int(mx.sum(is_image).item())View on GitHub (pinned to 21a54c5ea0)
When it happens
Trigger: Thrown at src/exo/worker/engines/mlx/vision.py:635 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of exo-explore/exo@21a54c5ea0 (2026-08-26).
Data as JSON: /api/errors/2b919058a31e2162.
Report an issue: GitHub.