Skip to content

Comments

Add prompt preprocessing and token placeholders for Omni#3062

Merged
copybara-service[bot] merged 1 commit intomainfrom
hengtaoguo-omni-utils2
Feb 21, 2026
Merged

Add prompt preprocessing and token placeholders for Omni#3062
copybara-service[bot] merged 1 commit intomainfrom
hengtaoguo-omni-utils2

Conversation

@hengtaoguo
Copy link
Collaborator

@hengtaoguo hengtaoguo commented Feb 2, 2026

Description

Collaborate with original author: @eitanporat at PR #2731.

  • Add reformat_prompt_qwen3_omni for prompt template.
  • Add get_mm_offsets_qwen3_omni to compute multimodal token lengths.
  • Update prepare_text_for_image_fusion, accepting config so it allows more complicated placeholder formatting by using model-specific config fields.

Tests

Follow up in e2e tests in #2729

Added two more test asserts in qwen3_omni_layers_test.py:

  • Check the formatted prompts are the same.
  • Check the tokenized IDs are the same (with multimodal placeholder paddings inside).
python -m pytest tests/unit/qwen3_omni_layers_test.py::TestQwen3OmniPreprocessing::test_preprocess_mm_data -vv -s

Prompt (with placeholders): https://paste.googleplex.com/6444051776798720
Tokenized prompt (with placeholders): https://diff.googleplex.com/#key=v8U2Vrap2cyR

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

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 16.00000% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/multimodal/processor.py 13.63% 17 Missing and 2 partials ⚠️
src/maxtext/decode.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hengtaoguo hengtaoguo force-pushed the hengtaoguo-omni-utils2 branch 6 times, most recently from 1392e74 to 2fcffaf Compare February 20, 2026 18:17
@hengtaoguo hengtaoguo changed the title Add Preprocessing and token placeholders Add prompt preprocessing and token placeholders for Omni Feb 20, 2026
@hengtaoguo hengtaoguo force-pushed the hengtaoguo-omni-utils2 branch from 1a100e9 to 4073136 Compare February 20, 2026 18:28
@hengtaoguo hengtaoguo force-pushed the hengtaoguo-omni-utils2 branch from d37c2bb to 5e78bbf Compare February 20, 2026 23:09
@copybara-service copybara-service bot merged commit 8badbdd into main Feb 21, 2026
35 of 39 checks passed
@copybara-service copybara-service bot deleted the hengtaoguo-omni-utils2 branch February 21, 2026 02:02
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