Skip to content

[model] feat: add audio data path and qwen3-omni model support.#6118

Open
SanftMonster wants to merge 13 commits into
verl-project:mainfrom
SanftMonster:init_audio_support
Open

[model] feat: add audio data path and qwen3-omni model support.#6118
SanftMonster wants to merge 13 commits into
verl-project:mainfrom
SanftMonster:init_audio_support

Conversation

@SanftMonster
Copy link
Copy Markdown
Contributor

@SanftMonster SanftMonster commented Apr 23, 2026

What does this PR do?

Add audio-input support and Qwen3-Omni Thinker model support to verl.

This PR extends the multimodal data path from image/video-only to image/video/audio, including dataset parsing, processor kwargs propagation, agent/teacher loop plumbing, rollout server request handling, and Qwen3-Omni mRoPE position-id construction. It also adds Qwen3-Omni Thinker-specific compatibility patches for transformers/vLLM weight loading, multimodal placeholder deduplication, and FSDP input casting so audio rollout and actor forward paths stay aligned.

Regression coverage is added for audio processor inputs, Qwen3-Omni multimodal fields, nested 3D position_ids, and padding conversion behavior.

Verification

To find the evidence of the implementation correctness, I ran the GSPO training of qwen3-omni-30B-A3B-instruct thinker. I used DailyOmni as the val dataset and omni-instruct as train set.

Firstly, the val results show similar metrics to that in qwen3-omni tech report

企业微信截图_86f05b3f-abdb-4142-aece-dcf6710c29aa 企业微信截图_a8e20192-bf86-4e17-a979-91e5c027566e

Secondly, the rollout-trainer logprobs diff stays in a reasonable range, as shown below.

企业微信截图_2e59de4a-acbd-4272-9931-f6a9d0f87426

Finally, the actor & reward metrics looks OK during the 120-steps training, as shown below.

企业微信截图_5acd55ae-f6a8-438b-91ac-4845b0d4f145 企业微信截图_35654192-b041-46c2-b90e-658e82c9c232

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, vllm_omni, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward, fully_async, one_step_off
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


jaxlliu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

@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 introduces support for the Qwen3-Omni model family, specifically the 'Thinker' sub-model, and extends the multimodal pipeline to support audio data alongside images and videos. Key changes include a monkey patch for the Qwen3-Omni MoE block to ensure gradient consistency under FSDP2, updates to agent loops and datasets for audio handling, and a new rule-based reward function for OmniInstruct. Review feedback identifies a potential runtime error in the MoE patch when top_k=1 and points out redundant weight normalization logic in the vLLM rollout worker.

# a no-op, so the arithmetic is unchanged.
for expert_idx in range(self.num_experts):
expert_layer = self.experts[expert_idx]
idx, top_x = torch.where(expert_mask[expert_idx].squeeze(0))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The use of .squeeze(0) here will cause a ValueError during unpacking if top_k is equal to 1. When top_k=1, the tensor becomes 1D after squeezing, and torch.where returns a single tensor instead of the expected two. Removing .squeeze(0) makes the logic robust for any top_k >= 1 as torch.where on a 2D tensor always returns indices for both dimensions.

Suggested change
idx, top_x = torch.where(expert_mask[expert_idx].squeeze(0))
idx, top_x = torch.where(expert_mask[expert_idx])

Comment on lines 373 to 380
model = self.model_runner.model
if getattr(model, "__class__", type(model)).__name__ == "CUDAGraphWrapper" and hasattr(model, "unwrap"):
model = model.unwrap()
if model.__class__.__name__ == "Qwen3OmniMoeThinkerForConditionalGeneration":
weights = [
(f"thinker.{name}" if not name.startswith("thinker.") else name, tensor) for name, tensor in weights
]
self.load_weights(weights)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This block is redundant and potentially inconsistent. Weight name normalization for Qwen3OmniMoeThinkerForConditionalGeneration is already handled by the call to self._normalize_weight_names(weights) at line 299. Additionally, the manual unwrapping of CUDAGraphWrapper is duplicated logic that is already encapsulated in self._get_weight_sync_model().

Suggested change
model = self.model_runner.model
if getattr(model, "__class__", type(model)).__name__ == "CUDAGraphWrapper" and hasattr(model, "unwrap"):
model = model.unwrap()
if model.__class__.__name__ == "Qwen3OmniMoeThinkerForConditionalGeneration":
weights = [
(f"thinker.{name}" if not name.startswith("thinker.") else name, tensor) for name, tensor in weights
]
self.load_weights(weights)
self.load_weights(weights)

@wuxibin89
Copy link
Copy Markdown
Collaborator

Generative RL has been moved to verl-project/verl-omni

@SanftMonster SanftMonster changed the title [WIP] feat: add audio data path and qwen3-omni model support. [model] feat: add audio data path and qwen3-omni model support. May 8, 2026
@SanftMonster SanftMonster marked this pull request as ready for review May 8, 2026 08:23
@SanftMonster
Copy link
Copy Markdown
Contributor Author

@wuxibin89 OK, what about splitting this PR into two pieces? One is audio-data support in verl, the other is qwen3-omni thinker support in verl-omni.

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