feat: add --bars arg to control output length

generate_period() now accepts n_bars=N to stop after exactly N complete
bars. bars_completed is seeded from the prefix length so --bars counts
the full output, not just the generated tail.

scripts/generate.py exposes this as --bars (default: None = model decides).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-21 20:29:44 +03:00
parent f6ce2a41d3
commit 9e73fa5d32
3 changed files with 87 additions and 2 deletions
+3
View File
@@ -89,6 +89,8 @@ def main() -> None:
help="Nucleus sampling cutoff (default: 0.9).")
ap.add_argument("--max-tokens", type=int, default=300, dest="max_tokens",
help="Hard cap on generated tokens (default: 300).")
ap.add_argument("--bars", type=int, default=None,
help="Stop after this many complete bars (default: let the model decide).")
ap.add_argument("--seed", type=int, default=None,
help="Random seed for reproducibility.")
ap.add_argument("--tempo", type=int, default=90,
@@ -136,6 +138,7 @@ def main() -> None:
temperature=args.temperature,
top_p=args.top_p,
max_tokens=args.max_tokens,
n_bars=args.bars,
seed=args.seed,
)