Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion unirl/rollout/engine/vllm_omni/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<img_ratio_36>` 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) |
Expand Down
31 changes: 0 additions & 31 deletions unirl/rollout/engine/vllm_omni/patches/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,35 +622,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."""

Expand All @@ -666,7 +637,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()

Expand All @@ -676,6 +646,5 @@ def hijack() -> None:
"VLLMOmniHijack",
"patch_hv15_packed_lora_mapping",
"patch_hv15_refiner_torch_linear_lora",
"patch_per_request_ar_seed",
"patch_sigmas_passthrough",
]
Loading