From f43cea2321d2e76fd614e2b680949ac2441c4849 Mon Sep 17 00:00:00 2001 From: charon Date: Wed, 25 Nov 2026 14:41:58 +0000 Subject: [PATCH] feat(rm): add the AudioBox-Aesthetics reward --- docs/models/h3/h3.md | 5 ++++ docs/user-guide/rewards.md | 56 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/docs/models/h3/h3.md b/docs/models/h3/h3.md index 361e0ebf5..956f8702c 100644 --- a/docs/models/h3/h3.md +++ b/docs/models/h3/h3.md @@ -48,6 +48,11 @@ python3 scripts/run_diffusion_sft_h3_t2va.py # downloads the default dataset o Canonical recipe: `scripts/run_diffusion_grpo_h3_t2va_2gpu.py` — train, rollout, and PickScore colocated on 2 GPUs; 16:9 / 4 s (with `short_edge=768` the canvas is 1344×768 / 107 frames). +Audio-reward variant: `scripts/run_diffusion_grpo_h3_t2va_audiobox.py` swaps PickScore for +`--rm-type audiobox` (Meta AudioBox-Aesthetics, see [Rewards](../../user-guide/rewards.md)), scoring the +soundtrack H3 generates instead of the video frames; `--reward-key pq` trains on Production Quality. +It needs the engine's audio response (the sglang-miles change noted below). + **Status:** [🛡️ FG — Fully gated](../../user-guide/recipe-verification.md#fg) ```bash diff --git a/docs/user-guide/rewards.md b/docs/user-guide/rewards.md index 04a35f576..059b6d3ac 100644 --- a/docs/user-guide/rewards.md +++ b/docs/user-guide/rewards.md @@ -13,7 +13,7 @@ For `--custom-rm-path`, `--custom-reward-post-process-path`, and other | Stage | Flag | Role | |---|---|---| -| Reward type | `--rm-type` | Selects built-in scorer (`pickscore`, `hps`, `hpsv3`, `ocr`, `openai_api`, `custom_api`), or `none` for a constant 0 when the loss reads no reward (DMD2), which also skips decoding training rollouts; ignored when `--custom-rm-path` is set | +| Reward type | `--rm-type` | Selects built-in scorer (`pickscore`, `hps`, `hpsv3`, `ocr`, `openai_api`, `custom_api`, `audiobox`), or `none` for a constant 0 when the loss reads no reward (DMD2), which also skips decoding training rollouts; ignored when `--custom-rm-path` is set | | API reward config | `--openai-api-rm-config`, `--custom-api-rm-config` | YAML file or inline `base64:` for the two API rewards | | Per-sample override | `metadata.rm_type` in JSONL | Overrides global `--rm-type` | | Custom reward / norm | see [Customization](customization.md) | `--custom-rm-path`, `--custom-reward-post-process-path` | @@ -141,6 +141,57 @@ Example from `scripts/run_diffusion_grpo_sd3_hpsv3_sglang.py`: --hpsv3-reward-colocate ``` +### AudioBox Aesthetics (`--rm-type audiobox`) + +Implementation: `miles/rollout/rm_hub/audiobox.py`, with the model vendored under +`miles/rollout/rm_hub/_audiobox/`. + +[Meta's Audiobox-Aesthetics](https://arxiv.org/abs/2502.05139) scores the **audio track** of a +joint audio-video generation (MiniMax H3 `t2va`) on four perceptual axes: + +- `pq` Production Quality — acoustic fidelity / clarity +- `pc` Production Complexity — how involved the content is +- `ce` Content Enjoyment — how pleasant the content is +- `cu` Content Usefulness — how useful the content is + +- Checkpoint: `--audiobox-checkpoint-path` (optional; defaults to `facebook/audiobox-aesthetics`) +- Model: a WavLM encoder plus one 5-layer MLP head per axis, running in fp32 + +Scoring: the predictor resamples the `[C, L]` waveform to 16 kHz mono, windows it into 10 s +chunks (a 4 s H3 clip is one chunk), averages the per-chunk scores, and de-normalises each head +with the mean/std shipped in the checkpoint. The raw scores land near the 1–10 human scale. + +It returns a dict per sample `{"pq", "pc", "ce", "cu", "overall"}`, where +`overall = pq_weight*pq + pc_weight*pc + ce_weight*ce + cu_weight*cu`. `--reward-key` picks the +entry GRPO trains on; every key also gets its own `rollout/reward/_mean` panel. + +AudioBox is **no-reference**: it scores the audio itself, not its alignment to the prompt. +`audiobox_rm` reads `sample.generated_audio` and `sample.audio_sample_rate` and raises when the +engine returns no audio, so it only makes sense for recipes whose rollout returns the soundtrack +(H3 `t2va` with the sglang-miles audio response). + +| Flag | Default | Description | +|---|---|---| +| `--audiobox-num-workers` | 1 | Ray actor count | +| `--audiobox-num-gpus-per-worker` | 1.0 | GPU per worker (non-colocate) | +| `--audiobox-batch-size` | 1 | Samples scored per actor call | +| `--audiobox-checkpoint-path` | None | `facebook/audiobox-aesthetics` repo id or local dir | +| `--audiobox-reward-colocate` | False | Seat the `--audiobox-num-workers` actors on rollout GPUs, one per placement-group bundle (requires `--colocate`) | +| `--audiobox-pq-weight` | 1.0 | Weight of `pq` in `overall` | +| `--audiobox-pc-weight` | 1.0 | Weight of `pc` in `overall` | +| `--audiobox-ce-weight` | 1.0 | Weight of `ce` in `overall` | +| `--audiobox-cu-weight` | 1.0 | Weight of `cu` in `overall` | + +Example from `scripts/run_diffusion_grpo_h3_t2va_audiobox.py` (H3 `t2va`, trained on PQ): + +```bash +--rm-type audiobox \ +--reward-key pq \ +--audiobox-num-workers 1 \ +--audiobox-batch-size 1 \ +--audiobox-reward-colocate +``` + ### Reward placement Every GPU reward pool is placed one of two ways: @@ -249,7 +300,8 @@ generate_and_rm_microgroup() → all ocr? ocr_rm (batched, one image per actor call) → all custom_api? custom_api_rm (batched, one request per actor call) → all openai_api? openai_api_rm (batched, one request per actor call) - → else per-sample async_rm → ocr / pickscore / hps / hpsv3 / custom_api / openai_api / NotImplementedError + → all audiobox? audiobox_rm (batched) + → else per-sample async_rm → ocr / pickscore / hps / hpsv3 / custom_api / openai_api / audiobox / NotImplementedError → sample.reward = score # after the rollout, in the RolloutManager Ray actor: