Skip to content

feat(rm): add CLAP as a built-in reward that scores the soundtrack (--rm-type clap) - #424

Open
ruiling-smartbear wants to merge 1 commit into
radixark:mainfrom
ruiling-smartbear:feat-clap-audio-reward
Open

ruiling-smartbear wants to merge 1 commit into
radixark:mainfrom
ruiling-smartbear:feat-clap-audio-reward

Conversation

@ruiling-smartbear

Copy link
Copy Markdown

Follow-up to #413 and #422: the audio-video LTX recipe has no reward that hears the audio. This adds CLAP as a built-in reward, --rm-type clap, scored on GeneratedMedia.audio.

What

  • rm_hub/clap.py: ClapRewardActor (required_media = frozenset({"audio"})) and AsyncClapPool, standalone or colocated like the other pools. Score = cosine of CLAP's prompt and audio embeddings, in [−1, 1].
  • Default checkpoint laion/larger_clap_general (--clap-model-path), loaded with transformers ClapModel, so no new dependency.
  • clap in async_rm, batched_async_rm and weighted_mixture_rm, e.g. --custom-rm-args "pickscore=1.0,clap=1.0".
  • Flags --clap-{num-workers,num-gpus-per-worker,reward-colocate,batch-size,model-path}, checked like the other pools'; docs in rewards.md and cli-reference.md.

Making the score a function of the clip

Choice Why
Mono, resampled to the model's 48 kHz at each sample's audio_sample_rate CLAP takes one channel at its own rate
A clip longer than the 10 s window is scored on evenly spaced full windows that cover it, averaged CLAP's own long-clip handling is a random crop: one 25 s clip scored 0.25–0.38 across seeds
is_longer zeroed a fusion checkpoint's extractor marks one random clip of a batch as longer (0.46 vs 0.49 for the same clip)
Prompt cut at 77 tokens the length CLAP's text tower was trained with

Validation

Rollouts CLAP mean
1–10 0.032
11–20 0.065
21–30 0.100
last 5 0.120

Slope +0.0033 per rollout (t = 4.4); per-rollout std ~0.14, so the reward is not constant within a group.

No recipe changes here; a PickScore + CLAP recipe for the audio-video run can follow once there is a reference curve on the 5-GPU setup.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant