Skip to content

[5/N][BREAKING][diffusion, rollout, tests] refactor: align diffusion prompt wire fields - #556

Draft
NancyFyong wants to merge 11 commits into
verl-project:mainfrom
NancyFyong:rfc403-pr5-wire-schema
Draft

[5/N][BREAKING][diffusion, rollout, tests] refactor: align diffusion prompt wire fields#556
NancyFyong wants to merge 11 commits into
verl-project:mainfrom
NancyFyong:rfc403-pr5-wire-schema

Conversation

@NancyFyong

@NancyFyong NancyFyong commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR5 of #403, stacked on #481 (0c4c40e). This PR is based on main for the upstream review, so its displayed diff includes #480/#481 until those merge. The PR5-only diff is 0c4c40e..HEAD.

  • Lower OmniRolloutRequest to one documented diffusion wire prompt: prompt_ids, negative IDs/masks, top-level media and processor kwargs, and extra-encoder IDs under extra_args.
  • Migrate all in-tree diffusion token readers, including request batching and step-execution paths, to the shared token-field boundary. SD3 reads both positive and negative extra-encoder IDs from the canonical location.
  • Remove the media double-write and Wan/Bagel copy-up/fallback code. MiniMax/Bagel's pinned upstream runtime actually reads top-level media, so this does not incorrectly move those inputs into extra_args just to satisfy the incomplete upstream TypedDict.
  • Keep vLLM's prompt_token_ids only when the first stage's declared stage_type is not diffusion, matching the pinned engine's preprocessing gate. Stage count is not a proxy for stage type. The shared reader rejects conflicting spellings. ARStrategy and the public Ray keyword API are unchanged.

Compatibility

This changes the internal diffusion prompt contract for external custom adapters: read prompt_ids through prompt_ids_from_payload, and read extra-encoder IDs under extra_args. Existing direct callers using AR token spelling remain accepted at the shared boundary. The conflict-checking historical condition-image parser remains a compatibility entrance; the server emits only one media location.

No upstream package, lifecycle code, training tensor keys, or model/tokenizer weights are modified. This is request-side work only; named output artifacts/layout migration belongs to PR6.

Duplicate-work check

Read #403 with comments and searched open PRs for 403 in:body, wire schema, and media artifacts. #480/#481 are the intended lower layers; no open PR implements this all-adapter wire migration. This continues, rather than duplicates, that series.

Tests

Environment: pinned verl fefb080, vllm-omni ded893462 (0.28).

PYTHONPATH=$PWD TORCH_COMPILE_DISABLE=1 TORCHINDUCTOR_DISABLE=1 OMP_NUM_THREADS=1 \
python -m pytest -q tests/ -o python_files='*_on_cpu.py' --asyncio-mode=auto
# 1199 passed, 26 warnings

New tests exercise canonical IDs at real Qwen/Boogu, MiniMax, Bagel, LTX and SD3 adapter extraction boundaries without loading weights; strategy tests cover both first-stage types independently of one/two-stage topology, media, negative/extra IDs and processor kwargs. The new stage-selection regression failed in two cases before the fix and passes after it. Existing batching/cache/step tests also pass.

Ruff 0.12.2 check/format, mypy 1.17.0 (repository configuration), generated-config verification, docs-time/docstrings/license/device-API/DataProto/structure checks, compileall, and whitespace checks passed. Hooks were run directly because the known host Git/pre-commit incompatibility prevents the launcher; mypy's repository-wide ignore_errors limits that evidence.

Upstream GPU CI remains pending. New local real-engine verification on the #557 stack exercises this wire path for Qwen FlowGRPO/DPO/NFT (including step execution), dual/mix, multi-encoder SD3, Boogu, Wan, LTX, MiniMax H3 NFT/FlowGRPO and single-stage Bagel. Qwen/SD3/Boogu packed-request checks verify multiple IDs in producer context. H3 NFT V0 and real V1/TQ complete a training step with CLAP/ImageBind and audiovisual export. See #557 for the complete current matrix, checkpoint/mode limitations and image-edit evidence. The AR entrance discriminator is covered by CPU topology tests, not a claimed multistage AR GPU pass. No unrelated GPU/Ray task was stopped.

Review follow-up (2026-09-08)

Current head dd3f453 merges the #480 review repairs through #481 without rewriting published history. The three processor-hook tests are restored, the I2I parser guide is current, and Boogu's redundant fallback is removed. Full CPU command above: 1199 passed; manual lint/config/sanity checks also passed. This test/docs/redundant-fallback follow-up does not claim a new GPU run.

Disclosure

AI assistance (Pi coding agent / OpenAI Codex) was used. Human review of every changed line and relevant validation are required before merge; this draft does not assert that the submitter has already completed that review.

NancyFyong and others added 7 commits September 3, 2026 11:45
…quest contract

Introduce a single typed request contract for diffusion/AR rollouts so the
server-side request handling and condition-image parsing stop threading loose
keyword arguments and re-deriving the same conventions in each strategy.

Add MediaInput, PromptBundle, and OmniRolloutRequest, then have the shared
generate template assemble one request object for both strategy preprocessors.
Keep the public generate keyword RPC and the current engine prompt keys intact
while forwarding multimodal processor metadata needed by Ref2VA.

Remove ImageGenerationRequest because its two consumers only used its image
alias lookup. Route those adapters through the shared parser instead, reject
conflicting aliases and malformed containers, and validate duplicate or invalid
media streams rather than silently overwriting them.

Fail explicitly when AR receives diffusion-only prompt fields or diffusion
receives an unsupported nonzero priority. Valid existing requests remain wire
compatible; tree-wide canonical engine-key migration remains a later PR.

Part of the verl-project#403 RFC, following merged PR verl-project#478.

AI assistance (Pi coding agent / OpenAI Codex) was used for this change.

Co-authored-by: OpenAI Codex
Signed-off-by: NancyFyong <2742092809@qq.com>
…media kind

Propagate the adapter-declared primary modality (media_kind) downstream so
consumers stop guessing modality from tensor rank, and make V1 diffusion media
dumps reliable.

- V0 ray_diffusion_trainer: read declared media_kind (top-level non_tensor_batch
  first, tool_extra_fields fallback) and pass it into validation/wandb wrapping
  and generation dumping instead of is_video=ndim==5.
- V1 trainer_base: delegate validation logging and generation writing to the
  shared V0 image/video/audio wandb+export paths via BaseRayDiffusionTrainer,
  pass media_kind/audio/audio_sample_rate/fps/validation_data_max_samples, and
  make background media dumps fail-open (futures keyed by global step, failures
  reported by _report_dump_failure instead of rethrown into training). Wire
  rollout_data_save_freq, rollout_data_max_samples, video_fps, and a thread-safe
  global-step snapshot.
- TransferQueue (DiffusionAgentLoopWorkerTQ): preserve non-tensor media_kind and
  audio_sample_rate in the extra_fields envelope restored by
  diffusion_tq_batch_to_dataproto (tq_utils), and optional metadata arrays
  initialize with None via np.full instead of uninitialized np.empty for mixed
  present/missing rows.
- rollout_media / DiffusionStrategy: keep only adapter-declared media_kind
  propagation; the Layout enum and media_layout were removed (moved to PR6).
- tracking.wrap_val_samples_for_wandb: accept media_kinds, prefer declared kind
  over rank with rank as fallback, handle 5D batched video, and convert both
  video and image failures into warning + unavailable placeholder instead of
  raising into training.

CPU-validated: 74 targeted tests across strategy, tracking-media, MiniMax
contract, V1 media dump/replay, and agent-loop correctness; py_compile and
whitespace clean.

AI assistance (Pi coding agent / OpenAI Codex) was used for this change.

Co-authored-by: OpenAI Codex
Signed-off-by: NancyFyong <2742092809@qq.com>
…casting

Compare NumPy and Torch payloads by shape and contents instead of scalar truth conversion, preserving equivalent aliases and rejecting broadcast-only matches.

AI assistance (Pi coding agent / OpenAI Codex) was used for this change.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
…onsumer boundaries

Validate modality and supported auxiliary streams before consumption. Forward generated media to colocated reward scorers, reject conflicting sources, and contain filesystem and logger failures without swallowing modality errors.

AI assistance (Pi coding agent / OpenAI Codex) was used for this change.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
…prompt wire fields

Use one diffusion token/media contract across adapters without moving
multimodal inputs away from the pinned upstream runtime readers. Keep
the initial AR-stage token entrance explicit and conflict-checked.

AI assistance (Pi coding agent / OpenAI Codex) was used.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
Copilot AI lite review requested due to automatic review settings September 7, 2026 08:06

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Match the pinned engine preprocessing gate instead of inferring AR
preprocessing from the number of stages. Regression cases cover both
stage kinds with one and two stages.

AI assistance (Pi coding agent / OpenAI Codex) was used.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
@NancyFyong NancyFyong changed the title [5/6][BREAKING][diffusion, rollout, tests] refactor: align diffusion prompt wire fields [5/N][BREAKING][diffusion, rollout, tests] refactor: align diffusion prompt wire fields Sep 7, 2026
Keep the three processor-hook regression tests when removing the obsolete
ImageGenerationRequest tests. Update the I2I guide to the shared parser
and remove its redundant Boogu fallback.

Validation: 37 targeted CPU tests and 1140 full CPU tests passed;
manual lint, format, mypy, config and sanity checks passed.
AI assistance (Pi coding agent / OpenAI Codex) was used.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
NancyFyong and others added 2 commits September 8, 2026 12:25
…umers

Merge the restored processor-hook coverage, current I2I parser docs and
redundant-fallback fix from PR3 without rewriting the published stack.

Validation: 1181 CPU tests and manual sanity checks passed.
AI assistance (Pi coding agent / OpenAI Codex) was used.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
…erage

Carry PR3 review repairs through the request-wire stack while retaining
published history.

Validation: 1199 CPU tests and manual sanity checks passed.
AI assistance (Pi coding agent / OpenAI Codex) was used.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: NancyFyong <2742092809@qq.com>
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.

2 participants