Skip to content

Fix param mapping for Qwen2#3466

Merged
copybara-service[bot] merged 1 commit intomainfrom
jimmytsai/fix-param-mapping-for-qwen2
Mar 25, 2026
Merged

Fix param mapping for Qwen2#3466
copybara-service[bot] merged 1 commit intomainfrom
jimmytsai/fix-param-mapping-for-qwen2

Conversation

@ChingTsai
Copy link
Copy Markdown
Collaborator

@ChingTsai ChingTsai commented Mar 20, 2026

Description

  • Resolves param_mapping.py conflicts introduced in this commit.
    • Add back the mapping for Qwen2.5-7b and Qwen2.5-14b

Tests

end2end test for qwen2.5-7b

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...xtext/checkpoint_conversion/utils/param_mapping.py 18.18% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

🤖 Hi @RissyRan, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link
Copy Markdown
Collaborator

@RissyRan RissyRan left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary

This PR successfully fixes the parameter mapping for Qwen2 models by restoring support for qwen2.5-7b and qwen2.5-14b. It also introduces necessary Q/K/V bias hooks and cleanly renames the internal mapping functions to be more general (QWEN_ instead of QWEN3_).

🔍 General Feedback

  • The addition of reshape_bias perfectly complements the new bias hooks for Qwen attention layers.
  • Consider removing the redundant conditional in the reshape_bias function to keep the code DRY, as the underlying reshape operation inherently handles both directions correctly.

Comment thread src/maxtext/checkpoint_conversion/utils/param_mapping.py Outdated
@ChingTsai ChingTsai force-pushed the jimmytsai/fix-param-mapping-for-qwen2 branch 2 times, most recently from 19b0ea1 to c6679fa Compare March 24, 2026 05:15
Copy link
Copy Markdown
Collaborator

@richjames0 richjames0 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Collaborator

@A9isha A9isha left a comment

Choose a reason for hiding this comment

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

Thanks!

"""Creates parameter transformation functions for Qwen.

This function provides a dictionary of transformation functions (hooks) for
converting Qwen3 model parameters between MaxText and Hugging Face formats.
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.

nit: This still says Qwen3 in the comment

@ChingTsai ChingTsai force-pushed the jimmytsai/fix-param-mapping-for-qwen2 branch from c6679fa to f884db6 Compare March 25, 2026 01:53
@copybara-service copybara-service Bot merged commit 2052c22 into main Mar 25, 2026
30 of 31 checks passed
@copybara-service copybara-service Bot deleted the jimmytsai/fix-param-mapping-for-qwen2 branch March 25, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants