Skip to content

Planner-LM adapter training: lm-train, lm-batch, --lm-train chaining - #64

Open
scragnog wants to merge 1 commit into
koda-dernet:mainfrom
scragnog:pr/planner-lm
Open

Planner-LM adapter training: lm-train, lm-batch, --lm-train chaining#64
scragnog wants to merge 1 commit into
koda-dernet:mainfrom
scragnog:pr/planner-lm

Conversation

@scragnog

Copy link
Copy Markdown

Planner-LM adapter training: lm-train, lm-batch, --lm-train chaining

ACE-Step 1.5 generation is a two-model system: the 5Hz planner LM writes the audio-code sequence, then the DiT renders it. Side-Step trains DiT adapters — but for artists whose identity lives in structure (song form, phrasing, vocal placement, typical bpm/keys), a DiT LoRA alone can't capture it. This adds the other half: LoRA adapters for the acestep-5Hz-lm-* planner (Qwen3 bases, 0.6B/1.7B/4B).

lm-train — a three-stage pipeline over the same preprocessed dataset dirs used for DiT training:

  1. extract: dataset songs → code-sequence JSONL (cached; --lm-refresh-codes to redo)
  2. train: PEFT LoRA SFT, prompt tokens masked, loss on the audio-code completion; --lm-loss-on-cot (default on) also trains the CoT metas block so the adapter learns artist-typical bpm/keys; --lm-target-loss stops at a mean CE/token target so fit is normalized across dataset sizes (--lm-epochs becomes a safety cap)
  3. export: raw PEFT adapter dir (for engines with a runtime LM-LoRA path) and/or a merged HF safetensors checkpoint named acestep-5Hz-lm-{size}-{name} — standard format, loadable by anything that scans HF checkpoint dirs

lm-batch — resumable multi-dataset campaign (one adapter per artist dataset) with --watch mode that picks up datasets as a concurrent preprocessing job completes them.

train --lm-train before|after — chains an LM adapter run around a DiT run in a subprocess, guaranteeing a clean VRAM lifecycle on both sides.

The correctness-critical piece is lm/prompts.py: prompt construction byte-mirrors the inference-side Phase-2 prompt + CoT YAML (verified against a production C++ engine implementation of the 5Hz LM prompt builder). Training against even a slightly different prompt distribution silently produces adapters the engine never actually exercises.

Self-contained: no changes to existing training paths; heavy deps import only inside the new subcommands.

🤖 Generated with Claude Code

…aining

Trains LoRA adapters for the ACE-Step 5Hz planner LM so song structure,
phrasing and vocal placement can be specialized per artist,
complementing the DiT adapter (timbre/production).

- lm-train: extract (dataset songs -> code-sequence JSONL, cached) ->
  train (PEFT LoRA SFT on Qwen3 base, prompt-masked, CoT-aware, with
  --lm-target-loss normalized early stop) -> export
- export modes: raw PEFT adapter dir (runtime LM-LoRA) and/or merged
  HF safetensors checkpoint (loadable by anything that scans HF dirs)
- lm-batch: resumable multi-dataset campaign with watch mode
- train --lm-train before|after: chain an LM adapter run around DiT
  training in a subprocess (clean VRAM lifecycle on both sides)

Prompt construction byte-mirrors the inference-side 5Hz LM prompt
builder (Phase-2 + CoT YAML), which is the correctness-critical part.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@scragnog, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b7b6c615-e64c-4d5f-a587-fb043880fb51

📥 Commits

Reviewing files that changed from the base of the PR and between ecd13bd and a3aa08d.

📒 Files selected for processing (10)
  • sidestep_engine/cli/args.py
  • sidestep_engine/cli/train_fixed.py
  • sidestep_engine/lm/__init__.py
  • sidestep_engine/lm/batch.py
  • sidestep_engine/lm/export_lm.py
  • sidestep_engine/lm/extract.py
  • sidestep_engine/lm/prompts.py
  • sidestep_engine/lm/run.py
  • sidestep_engine/lm/train_lm.py
  • train.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@scragnog
scragnog marked this pull request as ready for review July 29, 2026 10:54
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