Skip to content

[fix] configure Qwen3.5 MoE aux loss#10636

Open
kmishra1204 wants to merge 1 commit into
hiyouga:mainfrom
kmishra1204:codex/qwen35-moe-aux-loss
Open

[fix] configure Qwen3.5 MoE aux loss#10636
kmishra1204 wants to merge 1 commit into
hiyouga:mainfrom
kmishra1204:codex/qwen35-moe-aux-loss

Conversation

@kmishra1204

Copy link
Copy Markdown
Contributor

What\n\nAdds qwen3_5_moe to the MoE aux-loss configuration path so training enables router logits and propagates moe_aux_loss_coef for Qwen3.5 MoE configs.\n\nFixes #10302.\n\n## Why\n\nQwen3.5 MoE is already handled in related model utility paths, including ZeRO-3 leaf-module setup, but configure_moe omitted it from the router-logit and aux-loss model type lists.\n\n## Test\n\n- uv run --python 3.11 --with pytest --with torch --with transformers --with packaging --with pyyaml --with pydantic --with-editable . pytest tests/model/model_utils/test_moe.py -q\n- uv run --python 3.11 --with ruff ruff check src/llamafactory/model/model_utils/moe.py tests/model/model_utils/test_moe.py\n- uv run --python 3.11 --with ruff ruff format --check src/llamafactory/model/model_utils/moe.py tests/model/model_utils/test_moe.py\n- git diff --check

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the 'qwen3_5_moe' model type in the MoE configuration utility and includes a corresponding unit test to verify the correct application of auxiliary loss and router logits settings. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@kmishra1204

Copy link
Copy Markdown
Contributor Author

Additional Docker proof from a bounded one-shot container using the existing local LLaMA-Factory image:

docker run --rm --name codex-llamafactory-qwen35-proof --cpus=2 --memory=6g \
  -e DISABLE_VERSION_CHECK=1 -e PYTHONPATH=/workspace/src \
  -v "E:\Industry Codebases\oss-contributions\LLaMA-Factory:/workspace" \
  -w /workspace --entrypoint bash hiyouga/llamafactory:latest -lc "python --version && python -m pip install --no-cache-dir pytest ruff >/tmp/pip-proof.log && python -m pytest tests/model/model_utils/test_moe.py -q && python -m ruff check src/llamafactory/model/model_utils/moe.py tests/model/model_utils/test_moe.py && python -m ruff format --check src/llamafactory/model/model_utils/moe.py tests/model/model_utils/test_moe.py"

Result:

  • Python 3.11.11
  • tests/model/model_utils/test_moe.py: 1 passed
  • ruff check: passed
  • ruff format --check: passed

Note: DISABLE_VERSION_CHECK=1 is only for this source-level container proof because the pre-existing local image has transformers==5.6.0, which current source intentionally rejects. The test still imports the mounted PR source via PYTHONPATH=/workspace/src.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant