Skip to content

fix dtype mismatch when using vocab_tiling#3727

Open
aireenmei wants to merge 1 commit intomainfrom
aireen/vocab_dtype
Open

fix dtype mismatch when using vocab_tiling#3727
aireenmei wants to merge 1 commit intomainfrom
aireen/vocab_dtype

Conversation

@aireenmei
Copy link
Copy Markdown
Collaborator

@aireenmei aireenmei commented Apr 22, 2026

Description

Fix this error when testing gemma4 with bfloat16 and num_vocab_tiling=8

Tests

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 Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/maxtext/utils/vocabulary_tiling.py Outdated
@@ -228,6 +228,8 @@ def _bwd_scan_body(grad_params_acc, chunk_data):
# grad_params = jax.tree_util.tree_map(lambda x, y: y.astype(x.dtype), gathered_params, grad_params)
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.

could you remove the comments in line 227 and 228?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Cleaned the comments as discussed offline

Copy link
Copy Markdown
Collaborator

@NuojCheng NuojCheng left a comment

Choose a reason for hiding this comment

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

thank you for the fix!

Copy link
Copy Markdown
Collaborator

@gobbleturk gobbleturk left a comment

Choose a reason for hiding this comment

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

Is there a compile test using vocab tiling that should have caught this? Can we add some test protecting this?

@aireenmei aireenmei force-pushed the aireen/vocab_dtype branch from e8d8140 to a912927 Compare April 23, 2026 00:26
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.

3 participants