Fix OLMoE support and silent model-init failures - #119
Open
danielesalpietro wants to merge 4 commits into
Open
Conversation
- moe_infinity/utils/hf_config.py: parse_moe_param()/parse_expert_id()
were missing an "olmoe" branch, even though olmoe is registered in
moe_infinity/common/constants.py's MODEL_MAPPING_NAMES/
MODEL_MAPPING_TYPES and has a working monkey-patch class
(SyncOlmoeMoEBlock in moe_infinity/models/olmoe.py). Loading any
OLMoE checkpoint raised RuntimeError("Unsupported architecture
...forcausallm"). OLMoE's config fields (num_experts,
num_experts_per_tok) and expert parameter naming
(layers.N.mlp.experts.M....) match the already-handled qwen3 branch,
so "olmoe" was added there in both functions. The same
registry/parser gap still exists for dbrx, jamba, and opt.
- moe_infinity/entrypoints/openai/api_server_v2.py: _initialize_model()
had no except clause, and runs as a fire-and-forget
asyncio.create_task that nothing ever awaits or inspects
(startup_event()). Any exception raised while constructing the model
(unsupported architecture, CUDA allocation failure, etc.) was
silently dropped: the process kept running, /health stayed on
"starting" forever, and every request got a 503 indistinguishable
from a genuine hang -- this is what made the OLMoE bug above so hard
to diagnose in the first place. The exception is now logged
(logger.exception) and surfaced through /health as
{"status": "unhealthy", "reason": "<exception>"}.
Verified: allenai/OLMoE-1B-7B-0924-Instruct now loads and serves
correctly via /v1/chat/completions with these fixes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
drunkcoding
previously approved these changes
Jul 19, 2026
2 tasks
Same root cause as EfficientMoE#121: installing torch pulls in setuptools>=77.0.3 as a transitive dependency, upgrading the environment's setuptools past the exact pin. Under --no-isolation, python -m build then fails its build-dependency check because the installed version no longer matches ==75.3.2. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…den dim mismatch MODEL_MAPPING_TYPES["olmoe"] was set to 4 (MIXTRAL_MOE_DENSE_ACT_DENSE), which makes MoEMLP::ForwardHelper read expert weight buffers in Mixtral's gate/down/up order (matching w1/w2/w3). But OlmoeMLP registers weights as gate_proj/up_proj/down_proj (same convention as qwen3, already mapped to 5/DEEPSEEK_MOE_DENSE_ACT_DENSE). This swapped up_proj and down_proj for every OLMoE expert, crashing fused_moe_ffn_into's H == H_out check whenever hidden_size != intermediate_size (e.g. allenai/OLMoE-1B-7B-0924-Instruct: hidden_size=2048, intermediate_size=1024). Fixes EfficientMoE#123 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
danielesalpietro
left a comment
Contributor
Author
There was a problem hiding this comment.
This strongly suggests "olmoe": 4 was simply a copy/paste slip and should be 5.
danielesalpietro
left a comment
Contributor
Author
There was a problem hiding this comment.
This strongly suggests "olmoe": 4 was simply a copy/paste slip and should be 5.
This was referenced Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
moe_infinity/utils/hf_config.py: parse_moe_param()/parse_expert_id() were missing an "olmoe" branch, even though olmoe is registered in moe_infinity/common/constants.py's MODEL_MAPPING_NAMES/ MODEL_MAPPING_TYPES and has a working monkey-patch class (SyncOlmoeMoEBlock in moe_infinity/models/olmoe.py). Loading any OLMoE checkpoint raised RuntimeError("Unsupported architecture ...forcausallm"). OLMoE's config fields (num_experts, num_experts_per_tok) and expert parameter naming (layers.N.mlp.experts.M....) match the already-handled qwen3 branch, so "olmoe" was added there in both functions. The same registry/parser gap still exists for dbrx, jamba, and opt.
moe_infinity/entrypoints/openai/api_server_v2.py: _initialize_model() had no except clause, and runs as a fire-and-forget asyncio.create_task that nothing ever awaits or inspects (startup_event()). Any exception raised while constructing the model (unsupported architecture, CUDA allocation failure, etc.) was silently dropped: the process kept running, /health stayed on "starting" forever, and every request got a 503 indistinguishable from a genuine hang -- this is what made the OLMoE bug above so hard to diagnose in the first place. The exception is now logged (logger.exception) and surfaced through /health as {"status": "unhealthy", "reason": ""}.
Verified: allenai/OLMoE-1B-7B-0924-Instruct now loads and serves correctly via /v1/chat/completions with these fixes.
Motivation
Loading any OLMoE checkpoint raised RuntimeError("Unsupported architecture ...forcausallm")
Type of Change
Checklist