Repository navigation
feat(rm): score GeneratedMedia and let each reward declare the fields it requires - #422
Merged
Rockdu merged 1 commit intoNov 24, 2026
Conversation
… it requires Rewards were handed generated_output alone, so the waveform an audio-video rollout produces could not reach any reward. Every reward entry now hands its pool one GeneratedMedia per sample (visual, audio, audio_sample_rate), and each scorer class declares required_media. The pool rejects a scorer whose declaration is missing or names no known field when the pool is built, rejects a sample missing a required field, and sends no other tensor field, so image rewards neither move nor read a waveform. Breaking: the outputs a reward actor's score_batch receives, and the output ApiRewardActor.build_request receives, are GeneratedMedia records instead of tensors (the video is output.visual); a scorer class, including every ApiRewardActor subclass, must declare required_media.
Rockdu
marked this pull request as ready for review
November 24, 2026 22:20
Rockdu
merged commit Nov 24, 2026
3dcb12a
into
rockdu/rollout-waveform-from-extra-streams
42 of 47 checks passed
4 of 6 tasks
Rockdu
added a commit
that referenced
this pull request
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #408 (the waveform reaches
Sample.generated_audio). The diff here is the one commit on top of it.What
GeneratedMedia(miles/utils/types.py): what one sample generated, by stream name:visual(Sample.generated_output),audio(Sample.generated_audio) andaudio_sample_rate.Sample.generated_mediabuilds it.GeneratedMediarecords instead of video tensors, and each scorer class declaresrequired_media:frozenset({"visual"})for PickScore, HPS, HPSv3, OCR and the OpenAI image actor.AsyncRewardActorPoolreadsrequired_mediawhen it is built (a missing declaration, an empty one or an unknown field name fails there), rejects a sample that lacks a required field, and sends the scorer only the tensor fields it requires. An image reward therefore neither moves nor reads a waveform.--use-output-store, the reward actor reads the stored videos of a batch, then its stored waveforms.Why
Rewards were handed
generated_outputalone, so the audio of an audio-video rollout (LTX, #413) could not reach any reward. This PR is the interface only: it adds no audio reward model and changes no recipe.Breaking
ApiRewardActor.build_request(output, prompt):outputis aGeneratedMedia; the video isoutput.visual. A subclass must declarerequired_media.AsyncRewardActorPool: its actor class declaresrequired_media, and itsscore_batch(outputs, prompts)receivesGeneratedMediarecords.--custom-rm-pathfunction that readssample.generated_outputitself is not affected;Sample's fields are unchanged.Validation
CPU only.
tests/fast/rollout,tests/fast/utils/test_diffusion_rollout_response.py,test_api_rm_config.py,test_output_store_materialize.py, on Linux (twotest_sft_read_media.pycases that need a writable HF cache are deselected; they fail onmainthere too)55ca215, on #408fd1f509andmain4cb1a29pre-commiton the touched files55ca215The image reward scores are meant to be unchanged: each scorer reads
output.visual, the tensor it was handed before, and the existing scorer tests keep their numbers.Not validated:
run-ci-basicon this PR runs the three default e2e tests.Files
miles/utils/types.py:GeneratedMedia,Sample.generated_media.miles/rollout/rm_hub/core.py: the pool'srequired_mediacheck and field selection; the stored-output actor reads videos and waveforms.miles/rollout/rm_hub/{pickscore,hps,hpsv3,ocr,api,openai_api}.py:required_media; scorers readoutput.visual.tests/fast/rollout/test_reward_media.py(new,stage-a-cpu): the pool's contract. The other test files undertests/fast/rollout/passGeneratedMediawhere they passed tensors.docs/user-guide/rewards.md,docs/user-guide/customization.md: the scorer interface, which the breaking changes above would otherwise leave wrong. They describe the interface only, not how to train with an audio reward.Checklist
pre-commit run --all-filespasses — run on the touched files only, cleanpytest -xis green — CPU subset only, see Validationpython3 train.py --helpstill parses — no flag changed