Skip to content

Qwen3.5 vision layers ckpt conversion and decode#4027

Open
hengtaoguo wants to merge 2 commits into
mainfrom
hengtaoguo-q35-vis
Open

Qwen3.5 vision layers ckpt conversion and decode#4027
hengtaoguo wants to merge 2 commits into
mainfrom
hengtaoguo-q35-vis

Conversation

@hengtaoguo
Copy link
Copy Markdown
Collaborator

@hengtaoguo hengtaoguo commented May 31, 2026

Description

This PR supports Qwen3.5-35B model's vision tower checkpoint conversion and enables decode. The JAX layers have been implemented in #3962 , mostly inherited from Qwen3-Omni. The deltas in this PR:

  1. Added vision configs for qwen3.5-25b-a3b.yml.
  2. Added vision tower parameter mapping for Qwen3.5 in param_mapping.py for weights conversion.
  3. Register qwen3.5-25b-a3b throughout the multimodal workflow.
  4. Reuse Qwen3-Omni preprocessing utils since they are almost identical.
  5. Important Updates: Introduce QwenTokens, since Qwen3.5 changed the token_ids for some special multimodal tokens. QwenTokens will default to Qwen3-Omni so it doesn't impact existing flows.

Tests

Checkpoint conversion:

# Command:
export JAX_PLATFORMS=cpu
python -m maxtext.checkpoint_conversion.to_maxtext src/maxtext/configs/base.yml model_name=qwen3.5-35b-a3b base_output_directory=gs://hengtaoguo-maxtext-logs/checkpoints/qwen3.5-35b-a3b/unscanned/2026-06-01-15-15 use_multimodal=true scan_layers=false hf_access_token=<your_token>

Multimodal decode:

# Command
python -m maxtext.inference.decode maxtext/configs/base.yml model_name=qwen3.5-35b-a3b tokenizer_path=Qwen/Qwen3.5-35B-A3B tokenizer_type=huggingface load_parameters_path=gs://hengtaoguo-maxtext-logs/checkpoints/qwen3.5-35b-a3b/unscanned/2026-06-01-15-15/0/items per_device_batch_size=1 run_name=ht_test_decode_full steps=1 async_checkpointing=false scan_layers=false use_multimodal=true prompt=\'Describe\ this\ image\ in\ one\ sentence.\' image_path=\'tests/assets/test_image.jpg\' max_prefill_predict_length=512 max_target_length=542 attention=\'dot_product\' hf_access_token=<your_token> add_bos=False

# Result
Input `<|im_start|>user
<|vision_start|><|image_pad|><|vision_end|>Describe this image in one sentence.<|im_end|>
<|im_start|>assistant
` -> `<think>

</think>

This vibrant cityscape showcases Seattle’s iconic skyline under a bright blue sky, with the Space Needle standing tall among modern skyscrapers,`

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 May 31, 2026

Codecov Report

❌ Patch coverage is 3.57143% with 135 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...xtext/checkpoint_conversion/utils/param_mapping.py 0.00% 92 Missing ⚠️
src/maxtext/multimodal/processor_qwen3_omni.py 12.50% 28 Missing ⚠️
src/maxtext/multimodal/processor.py 6.66% 14 Missing ⚠️
src/maxtext/layers/encoders.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hengtaoguo hengtaoguo force-pushed the hengtaoguo-q35-vis branch 2 times, most recently from 466fd22 to 89996f8 Compare June 1, 2026 20:39
@hengtaoguo hengtaoguo force-pushed the hengtaoguo-q35-vis branch from 00c0cec to b45f2b6 Compare June 1, 2026 21:29
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.

1 participant