From daf3487d43c63537f5ce9455050d9948df4d8d22 Mon Sep 17 00:00:00 2001 From: leviking98z-rgb Date: Wed, 16 Sep 2026 15:41:32 +0800 Subject: [PATCH] fix(vllm-omni): retire per-request AR seed patch --- .../engine/vllm_omni/patches/README.md | 1 - .../engine/vllm_omni/patches/runtime.py | 31 ------------------- 2 files changed, 32 deletions(-) diff --git a/unirl/rollout/engine/vllm_omni/patches/README.md b/unirl/rollout/engine/vllm_omni/patches/README.md index e318c649f..18b31ec1d 100644 --- a/unirl/rollout/engine/vllm_omni/patches/README.md +++ b/unirl/rollout/engine/vllm_omni/patches/README.md @@ -46,7 +46,6 @@ All in `runtime.py` unless noted. | `patch_hv15_packed_lora_mapping` | HV1.5 exposes `packed_modules_mapping`, while the diffusion LoRA manager only reads a model-level `stacked_params_mapping`. Consequently all six logical Q/K/V targets per main block are loaded but neither packed projection is wrapped or activated. Translate the model's packed relationship into the attribute consumed by the manager | vllm-omni's LoRA manager reads HV1.5's `packed_modules_mapping` directly | | `patch_hv15_refiner_torch_linear_lora` | Pinned vllm-omni's diffusion LoRA manager replaces only vLLM linear classes. HV1.5 deliberately keeps the token-refiner projections as Diffusers `nn.Linear` layers, so configured refiner LoRA tensors are loaded but never applied to the rollout policy. Reuse the manager's PEFT target matcher to discover and wrap those ordinary linears with the same BF16 base-plus-adapter arithmetic | vllm-omni applies diffusion LoRA to HV1.5's ordinary token-refiner linears | | `patch_lora_request_passthrough` | `Omni.generate` never forwards `lora_request`, needed by the HI3 AR-prelude stage. Verified still absent at upstream main (~v0.22.0rc1); `AsyncOmniEngine.add_request` has accepted the kwarg all along, so a small upstream PR forwarding it would retire this | vllm-omni upstreams the kwarg (then the `ar_lora_passthrough` gate drops too) | -| `patch_per_request_ar_seed` | One `SamplingParams` is shared across requests, so a GRPO group's N requests collapse to identical tokens | vllm-omni stops sharing one `SamplingParams` | | `patch_sigmas_passthrough` | HI3's DiT `scheduler.set_timesteps` never receives `sampling_params.sigmas` | upstream forwards `sigmas` itself | | `install_fate_sharing` | `PR_SET_PDEATHSIG` is bound by Linux to the **specific creating thread**, so arming it for children of short-lived init threads kills healthy workers; and a worker inside a CUDA/NCCL call never observes vLLM's `death_pipe` EOF | vllm's own child-reaping is thread-safe | | `compat_tokenizer` (module) | HI3's `__init__` looks up `` and computes `ratio_36 + 1`; the Base checkpoint ships ratio tokens 0-32 only → `TypeError: … 'NoneType' and 'int'`. Both the slow **and** fast tokenizer classes must be patched, not the shared base. The module import *is* the install trigger (it is the `HI3ARWorkerExtension` qualname target). Upstream ≥ v0.20.0 raises a clean `ValueError` instead — a better error, but the Base ckpt still needs this 0-fallback to work | Base-ckpt support is dropped (Instruct ships the tokens) | diff --git a/unirl/rollout/engine/vllm_omni/patches/runtime.py b/unirl/rollout/engine/vllm_omni/patches/runtime.py index e47a49acf..5ca0b5e0b 100644 --- a/unirl/rollout/engine/vllm_omni/patches/runtime.py +++ b/unirl/rollout/engine/vllm_omni/patches/runtime.py @@ -642,35 +642,6 @@ def _patched_inner_call(self, *args, _orig=_orig_inner_call, **kwargs): pass -def patch_per_request_ar_seed() -> None: - """Stamp a fresh os.urandom seed onto every AR SamplingParams in add_request's sampling_params_list.""" - try: - import msgspec as _msgspec - from vllm import SamplingParams as VLLMSamplingParams - from vllm_omni.engine.async_omni_engine import AsyncOmniEngine - except (ImportError, AttributeError): - return - - _orig = AsyncOmniEngine.add_request - if getattr(_orig, "_diffrl_per_request_ar_seed", False): - return - - import os as _os - - def _patched(self, *args, sampling_params_list=None, _orig=_orig, **kwargs): - if sampling_params_list is not None: - sampling_params_list = [ - _msgspec.structs.replace(sp, seed=int.from_bytes(_os.urandom(4), "big")) - if isinstance(sp, VLLMSamplingParams) and getattr(sp, "seed", None) is None - else sp - for sp in sampling_params_list - ] - return _orig(self, *args, sampling_params_list=sampling_params_list, **kwargs) - - _patched._diffrl_per_request_ar_seed = True # type: ignore[attr-defined] - AsyncOmniEngine.add_request = _patched - - class VLLMOmniHijack: """Monkey-patches vllm-omni internals to support in-memory LoRA tensors.""" @@ -691,7 +662,6 @@ def hijack() -> None: patch_hv15_packed_lora_mapping() patch_hv15_refiner_torch_linear_lora() patch_lora_request_passthrough() - patch_per_request_ar_seed() patch_sigmas_passthrough() patch_moe_workspace_pool() @@ -701,6 +671,5 @@ def hijack() -> None: "VLLMOmniHijack", "patch_hv15_packed_lora_mapping", "patch_hv15_refiner_torch_linear_lora", - "patch_per_request_ar_seed", "patch_sigmas_passthrough", ]