Skip to content

Conversation

@brian-dellabetta
Copy link
Collaborator

SUMMARY:
Without this bugfix, examples/awq/qwen3_moe_example.py errors out with stack trace:

Replacing MoE modules for calibration:   0%|                                    | 0/48 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/brian-dellabetta/projects/llm-compressor/examples/awq/qwen3_moe_example.py", line 65, in <module>
    oneshot(
  File "/home/brian-dellabetta/projects/llm-compressor/src/llmcompressor/entrypoints/oneshot.py", line 348, in oneshot
    one_shot()
  File "/home/brian-dellabetta/projects/llm-compressor/src/llmcompressor/entrypoints/oneshot.py", line 172, in __call__
    self.apply_recipe_modifiers(
  File "/home/brian-dellabetta/projects/llm-compressor/src/llmcompressor/entrypoints/oneshot.py", line 216, in apply_recipe_modifiers
    with moe_calibration_context(
  File "/home/brian-dellabetta/.local/share/uv/python/cpython-3.10.18-linux-x86_64-gnu/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/brian-dellabetta/projects/llm-compressor/src/llmcompressor/modeling/moe_context.py", line 106, in moe_calibration_context
    replacement = MoECalibrationModule.load_from_registry(
TypeError: RegistryMixin.load_from_registry() takes 2 positional arguments but 4 were given

This resolves the bug (but subsequently hits another error #2022 )

TEST PLAN:
"please outline how the changes were tested"

Signed-off-by: Brian Dellabetta <bdellabe@redhat.com>
@github-actions
Copy link

👋 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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @brian-dellabetta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical TypeError that was preventing the examples/awq/qwen3_moe_example.py script from executing. The error occurred because the RegistryMixin.load_from_registry() method was being called with positional arguments where keyword arguments were expected. By updating the call in moe_context.py to use explicit keyword arguments, the MoECalibrationModule can now be correctly initialized, allowing the MoE calibration process to proceed without this specific failure.

Highlights

  • Bug Fix: Corrected a TypeError in moe_calibration_context by changing how arguments are passed to MoECalibrationModule.load_from_registry.
  • Argument Passing: Switched from positional arguments to explicit keyword arguments (original=module, config=model.config) when calling load_from_registry to match the method's signature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@brian-dellabetta brian-dellabetta added the ready When a PR is ready for review label Nov 11, 2025
Copy link
Contributor

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

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 resolves a TypeError that occurred when calling MoECalibrationModule.load_from_registry. The change correctly switches from using positional arguments to keyword arguments (original and config). This not only fixes the immediate bug but also improves the code's readability and makes the function call more robust against future changes in argument order. The fix is accurate and well-implemented.

@dsikka dsikka enabled auto-merge (squash) November 12, 2025 00:26
@dsikka dsikka merged commit c600e2e into main Nov 12, 2025
9 checks passed
@dsikka dsikka deleted the bdellabe/bugfix-qwen3-moe branch November 12, 2025 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready When a PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants