Skip to content

Remove GraniteMoeLinearExperts - #2885

Merged
kylesayrs merged 2 commits into
mainfrom
kylesayrs/fix-transformers-moe-update
Aug 19, 2026
Merged

Remove GraniteMoeLinearExperts#2885
kylesayrs merged 2 commits into
mainfrom
kylesayrs/fix-transformers-moe-update

Conversation

@kylesayrs

@kylesayrs kylesayrs commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Changes

  • Remove custom linearization logic for granitemoe
  • Rename DeepseekV3NaiveMoe, Glm4MoeNaiveMoe, Glm4MoeLiteNaiveMoe, GlmMoeDsaNaiveMoe, and GraniteMoeParallelExperts

Testing

  • test_linearize_moe passes

@kylesayrs
kylesayrs requested a review from dsikka as a code owner July 1, 2026 17:36
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0584b3a9-e565-4be6-a283-ef92f92c9876

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR removes the GraniteMoeLinearExperts wrapper class and its registry mapping, switches the linear_experts registration import to Llama4LinearExperts, removes the Granite-specific skip branch in reap utils' get_moe_attrs, and updates tests to use *Experts classes for Granite and related models, consolidating the standalone Granite test into the parametrized suite.

Changes

Granite MoE Linear Experts Removal

Layer / File(s) Summary
Remove GraniteMoeLinearExperts wrapper
src/llmcompressor/modeling/moe/granitemoe.py
Deletes the entire module, removing the GraniteMoeLinearExperts class and its registry mapping to GraniteMoeParallelExperts.
Registration import switch
src/llmcompressor/modeling/moe/linear_experts.py
LinearExperts2D.get_registration now imports Llama4LinearExperts instead of GraniteMoeLinearExperts as its side-effect trigger.
Reap utils filtering update
src/llmcompressor/modifiers/pruning/reap/utils.py
Removes the GraniteMoeLinearExperts import and its skip branch in get_moe_attrs, and updates the ValueError message to drop the reference, so Granite layers passing the general LinearExperts2D check are now treated as supported.
Test suite migration to *Experts classes
tests/llmcompressor/modeling/test_linearize.py
Updates imports and parametrized cases in test_linearize_moe to use *Experts classes (DeepseekV3Experts, GLM/Granite Experts, etc.) with adjusted kwargs, adds Granite-MoE coverage to the parametrization, and removes the standalone test_linearize_moe_granite function.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: moe, transforms, refactor

Suggested reviewers: HDCharles, brian-dellabetta

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: removal of the custom Granite MoE linear-experts implementation.
Description check ✅ Passed The description explains the Transformers compatibility goal, the Granite linearization changes, related renames, and testing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kylesayrs/fix-transformers-moe-update

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped vllm-project/compressed-tensors.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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 removes the GraniteMoeLinearExperts implementation and cleans up its references across the codebase, including the specialized test test_linearize_moe_granite. It also updates several MoE model imports in tests (replacing NaiveMoe and ParallelExperts with Experts variants) and adjusts test parameters. A review comment points out a grammatical typo in an error message in reap/utils.py and suggests a correction.

Comment thread src/llmcompressor/modifiers/pruning/reap/utils.py Outdated
@coderabbitai coderabbitai Bot added moe Refactor Code cleanup and/or improvements to existing features transforms Related to transforms-based modifiers like SpinQuant and Quip labels Jul 1, 2026
@kylesayrs kylesayrs added the ready When a PR is ready for full CI testing before merge label Jul 1, 2026
@kylesayrs
kylesayrs marked this pull request as draft July 1, 2026 18:01
@HDCharles

HDCharles commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Rename DeepseekV3NaiveMoe, Glm4MoeNaiveMoe, Glm4MoeLiteNaiveMoe, GlmMoeDsaNaiveMoe, and GraniteMoeParallelExperts

where does this actually happen? or is it just changed in the test?

Comment thread tests/llmcompressor/modeling/test_linearize.py Outdated
@kylesayrs
kylesayrs force-pushed the kylesayrs/fix-transformers-moe-update branch from 457caaf to 7ff0c6d Compare July 2, 2026 19:57
@kylesayrs
kylesayrs changed the base branch from main to kylesayrs/support-moe-more July 2, 2026 19:57
@kylesayrs kylesayrs changed the title Support latest transformers experts Remove GraniteMoeLinearExperts Jul 2, 2026
@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @kylesayrs.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Jul 6, 2026
@mergify

mergify Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Require one maintainer review

All PRs must have at least one approving review from a maintainer before merging.

  • #changes-requested-reviews-by = 0
  • any of:
    • approved-reviews-by=HDCharles
    • approved-reviews-by=brian-dellabetta
    • approved-reviews-by=dsikka
    • approved-reviews-by=kylesayrs
    • approved-reviews-by=yiliu30

@kylesayrs
kylesayrs force-pushed the kylesayrs/fix-transformers-moe-update branch from dcbceea to e83ca7a Compare August 19, 2026 05:33
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kylesayrs
kylesayrs force-pushed the kylesayrs/fix-transformers-moe-update branch from e83ca7a to 78b3249 Compare August 19, 2026 05:45
@kylesayrs
kylesayrs marked this pull request as ready for review August 19, 2026 05:47
@mergify mergify Bot removed the needs-rebase label Aug 19, 2026

@brian-dellabetta brian-dellabetta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have you confirmed the examples still work with these changes?

  • examples/quantizing_moe/granite_moe_example.py
  • examples/quantization_w8a8_fp8/granite4_example.py

@kylesayrs

Copy link
Copy Markdown
Collaborator Author

@brian-dellabetta I did e2e testing about a month ago when I opened this, but I feel confident that it still works since granitemoe is now in our regular parameterized unit tests

@kylesayrs
kylesayrs enabled auto-merge (squash) August 19, 2026 21:52
@kylesayrs
kylesayrs merged commit d10fdfe into main Aug 19, 2026
8 checks passed
@kylesayrs
kylesayrs deleted the kylesayrs/fix-transformers-moe-update branch August 19, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

moe ready When a PR is ready for full CI testing before merge Refactor Code cleanup and/or improvements to existing features transforms Related to transforms-based modifiers like SpinQuant and Quip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants