Add HPSv2 reward model support#8
Draft
MikukuOvO wants to merge 11 commits intoRockdu:diffusion_RL_v0.1from
Draft
Add HPSv2 reward model support#8MikukuOvO wants to merge 11 commits intoRockdu:diffusion_RL_v0.1from
MikukuOvO wants to merge 11 commits intoRockdu:diffusion_RL_v0.1from
Conversation
Wires in HPS / HPSv2.1 (ViT-H-14 + xswu/HPSv2 checkpoint) as a second reward model alongside PickScore. A training run selects it via --rm-type hps and --hps-version v2.1 (default). Includes a smoke script and a standalone compare_reward_models.py harness for PickScore vs HPS correlation checks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
1. Change Summary
Files changed
miles/rollout/rm_hub/__init__.pymiles/rollout/rm_hub/hps.pymiles/utils/arguments.pyrequirements.txtscripts/run-diffusion-grpo-hps-smoke.shWhat changed
miles/rollout/rm_hub/__init__.pyrm_type=hpsin the reward model dispatch path.miles/rollout/rm_hub/hps.py[C, F, H, W]into RGBuint8HWC images before scoring.ViT-H-14model throughhpsv2.src.open_clip.create_model_and_transforms, then loads the HPSv2 checkpoint weights.image_features @ text_features.T, matching the DanceGRPO HPSv2 reward formula.miles/utils/arguments.pyrequirements.txthpsv2runtime dependency.scripts/run-diffusion-grpo-hps-smoke.sh--rm-type hpsand wires the HPS-specific runtime arguments.2. Validation
I cloned the official DanceGRPO repo and used its HPSv2.1 reward implementation as the reference:
https://github.com/XueZeyue/DanceGRPOfastvideo/train_grpo_qwenimage.pyViT-H-14, then usetorch.diagonal(image_features @ text_features.T)as reward.I then ran one focused reward-alignment test on GPU 0 in
/root/miniconda3/envs/miles-rollout-test.The test uses the same 3 fixed prompt/image pairs and compares three paths:
HPSScorer.hps_rmpath withhps_batch_size=1, matching DanceGRPO's per-sample reward call granularity.3. Experiment Report
cat.pngtest.jpgflow_grpo_fast.pngResult:
raw_max_abs_diff_direct=0.000e+00raw_max_abs_diff_rm=0.000e+00The MILES direct scorer and Ray-backed reward path match the DanceGRPO HPSv2.1 reward exactly for these fixed inputs when using the same per-sample reward granularity.
Note: when multiple samples are scored in one AMP batch, HPS can show tiny BF16-level differences around
1.221e-04versus DanceGRPO's per-sample path. The validation above matches DanceGRPO's actual per-sample scoring path.4. Test Plan
HPSScorer, and Ray-backedhps_rmwithmax_abs_diff <= 1e-6.