Skip to content

Add Qwen3 Moe #2260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

kanpuriyanawab
Copy link
Collaborator

@kanpuriyanawab kanpuriyanawab commented May 19, 2025

Qwen3 Moe backbone output matching with atol 1e-3!

Screenshot 2025-07-18 at 8 08 10 PM

Generate output matching wise We are doing okay here!

keras hub - [ 3838, 374, 730, 9247, 30, 2585, 311, 5443, 730, 9247,
304, 13027, 1939, 42, 9247, 374, 458, 1787, 30774, 5538,
6832, 6733, 5326, 304, 13027, 13, 1084, 374, 6188, 311,
7283, 4937]

huggingface -[ 3838, 374, 730, 9247, 30, 730, 9247, 374, 264, 1550,
11591, 29728, 14155, 5333, 11, 5326, 304, 13027, 323, 12875,
315, 4303, 389, 1909, 315, 94986, 11, 356, 6408, 42,
11, 476]

@kanpuriyanawab kanpuriyanawab self-assigned this May 19, 2025
Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Thanks! Took an initial pass. Let's try to clean up the config and state passing.

No passing an index down the layer stack, plus data structures that apply to the whole layer stack.

@divyashreepathihalli
Copy link
Collaborator

/gemini review

Copy link

@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 adds support for the Qwen3 MoE model. The implementation looks solid, covering the backbone, attention, decoder, tokenizer, and conversion scripts. I've identified several high-severity issues related to incomplete get_config methods in various new layers, which will prevent model serialization from working correctly. There are also some medium-severity issues like unused parameters and a critical issue in the checkpoint conversion test script where an incorrect preprocessor is used. I've provided suggestions to fix these issues. Once addressed, the PR should be in great shape.

@sachinprasadhs sachinprasadhs moved this to In Progress in KerasHub Jul 16, 2025
@laxmareddyp laxmareddyp added the kokoro:force-run Runs Tests on GPU label Jul 18, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants