Utilities
Last updated: Jun 05, 2026 (API docstrings are auto-generated).
This section documents the small set of cross-cutting utilities provided by VeRL-Omni. Most other utilities (e.g. tracking, dataset collation) are inherited from upstream verl and are documented there.
File System Utilities
FSDP Utilities
VeRL-Omni reuses verl.utils.fsdp_utils verbatim and only overrides a
single helper to support layered LoRA collection on diffusers transformer-block
models (e.g. Qwen-Image).
- verl_omni.utils.fsdp_utils.collect_lora_params(module, layered_summon: bool, base_sync_done: bool, is_diffusers: bool = False, adapter_name: str = 'default', layer_prefixes: Sequence[str] = ('transformer_blocks.',)) OrderedDict[source]
Collect LoRA or base parameters for weight sync to the rollout worker.
Raises
RuntimeErrorwhen no parameters were collected (e.g. mismatchedlayer_prefixes).- Parameters:
module – The FSDP-wrapped or plain module.
layered_summon – Summon one FSDP unit at a time instead of the full model.
base_sync_done – If
True, collect only LoRA weights; else full base weights.is_diffusers – Use the diffusers-specific layered summon helper.
adapter_name – LoRA adapter name (usually
"default").layer_prefixes – FSDP layer name prefixes (
["transformer_blocks."]
Dataset Utilities
VeRL-Omni’s RLHF dataset class is a thin subclass of
verl.utils.dataset.rl_dataset.RLHFDataset that adds an optional
negative_prompt channel for classifier-free guidance. The get_collate_fn,
get_dataset_class, create_rl_dataset and create_rl_sampler helpers
keep callers importing dataset utilities from a single module.
- class verl_omni.utils.dataset.rl_dataset.RLHFDataset(*args, config: DictConfig, **kwargs)[source]
Upstream
RLHFDatasetextended withnegative_promptsupport.Diffusion models trained with classifier-free guidance need a paired negative prompt for every sample. We surface the raw negative prompt messages under
raw_negative_promptso the diffusion agent loop can encode them alongside the positive prompt.
- verl_omni.utils.dataset.rl_dataset.get_collate_fn(data_config: DictConfig)[source]
Get a custom collate function from data config, falling back to upstream default.
- verl_omni.utils.dataset.rl_dataset.get_dataset_class(data_config: DictConfig)[source]
Get RLHF dataset class.
- Parameters:
data_config – The data config.
- Returns:
The dataset class.
- Return type:
dataset_cls
- verl_omni.utils.dataset.rl_dataset.create_rl_dataset(data_paths, data_config, tokenizer, processor, is_train=True, max_samples: int = -1)[source]
Create a dataset.
- Parameters:
data_paths – List of paths to data files.
data_config – The data config.
tokenizer (Tokenizer) – The tokenizer.
processor (Processor) – The processor.
- Returns:
The dataset.
- Return type:
dataset (Dataset)
Diffusion Padding Utilities
See verl_omni.workers.utils.padding.embeds_padding_2_no_padding() in
the Workers Interface section.
vLLM-Omni LoRA Hooks
See verl_omni.utils.vllm_omni.utils.OmniTensorLoRARequest and
verl_omni.utils.vllm_omni.utils.VLLMOmniHijack in the
Rollout & Agent Loop section.