Skip to content

Fix: parser.int() silently drops multi-seed strings in release task request builder#787

Merged
ChuxiJ merged 1 commit intomainfrom
fix/issue-782-multi-seed-batch-parsing
Mar 7, 2026
Merged

Fix: parser.int() silently drops multi-seed strings in release task request builder#787
ChuxiJ merged 1 commit intomainfrom
fix/issue-782-multi-seed-batch-parsing

Conversation

@ChuxiJ
Copy link
Contributor

@ChuxiJ ChuxiJ commented Mar 7, 2026

Fixes #782

Summary

This PR fixes a bug where multi-seed batching was silently broken in the FastAPI server. When users provided comma-separated seeds (e.g., seed="1024,2048") with batch_size > 1, only the first sample remained deterministic due to incorrect parameter parsing.

Problem

The FastAPI request builder in acestep/api/http/release_task_request_builder.py was using parser.int("seed", -1) which attempted to convert comma-separated seed strings like "1024,2048" into an integer. This conversion silently failed and returned the default value -1, breaking the multi-seed feature.

Solution

Changed line 57 from:

seed=parser.int("seed", -1),

To:

seed=parser.get("seed", -1),

This preserves the raw seed value (whether string or int), allowing downstream code to parse it correctly.

Why This Works

The downstream prepare_seeds() function in acestep/core/generation/handler/task_utils.py already handles:

  • ✅ Comma-separated strings: "1024,2048" → parsed as list
  • ✅ Single integers: 1024 → treated as single seed
  • -1 or None → generates random seeds

The multi-seed pipeline was fully functional end-to-end, but the API request builder was breaking the chain by forcing int conversion.

Testing

Before fix: All batch samples got seed=-1 (non-deterministic)
After fix: Each sample gets its specified seed

Test command:

curl -X POST http://localhost:8001/release_task \
  -F "prompt=upbeat electronic music" \
  -F "batch_size=3" \
  -F "seed=1024,2048,4096"

Expected: Three deterministic outputs with different seeds.

Impact

  • Bug severity: Medium (breaks documented feature)
  • Backward compatibility: ✅ Maintained (single int seeds still work)
  • Lines changed: 1
  • Risk: Minimal (only affects seed parameter handling)

Checklist

  • Code change made
  • Commit message follows format
  • Backward compatibility verified
  • Tests run locally (requires full setup)
  • Documentation updated (if needed)

Summary by CodeRabbit

  • Bug Fixes
    • Improved seed parameter handling in music generation requests to ensure proper processing of missing or undefined values.

When passing comma-separated seeds (e.g., "1024,2048") with batch_size > 1,
parser.int() was silently converting the string to the default value (-1),
breaking deterministic multi-seed batch generation.

Changed seed parameter from parser.int() to parser.get() to preserve the
raw value (string or int). Downstream code in prepare_seeds() already
handles both formats correctly.

Fixes #782

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 7, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e506f11-c9a2-4b9e-acb7-a4c10fa47d75

📥 Commits

Reviewing files that changed from the base of the PR and between 746eec4 and 6d027f9.

📒 Files selected for processing (1)
  • acestep/api/http/release_task_request_builder.py

📝 Walkthrough

Walkthrough

Changed seed field retrieval in build_generate_music_request from parser.int() to parser.get() to preserve comma-separated seed strings for multi-seed batch support, enabling downstream pipeline handling of both integer and string seed formats.

Changes

Cohort / File(s) Summary
Seed Parsing Fix
acestep/api/http/release_task_request_builder.py
Switched seed field population from parser.int("seed", -1) to parser.get("seed", -1) to preserve comma-separated seed strings instead of silently coercing them to the default value, unblocking multi-seed batch functionality.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • PR #355: Adds robust seed parsing and preservation through the generation pipeline, complementing this fix by ensuring downstream components properly handle both single integer and comma-separated multi-seed formats.

Poem

🐰 A seed, once lost to parser's might,
Now flows through batches, pure and bright!
From one small change, a bloom unfolds—
Multi-seeds dance, as the string still holds! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the specific bug fix: replacing parser.int() with parser.get() to prevent silent loss of multi-seed strings.
Linked Issues check ✅ Passed The code change directly addresses all requirements from issue #782: replacing parser.int() with parser.get() preserves comma-separated seed strings for downstream processing.
Out of Scope Changes check ✅ Passed The change is a single-line edit in the seed parsing logic, directly addressing the linked issue with no additional or unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/issue-782-multi-seed-batch-parsing

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 and usage tips.

@ChuxiJ ChuxiJ merged commit edc950b into main Mar 7, 2026
2 of 3 checks passed
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.

Fastapi: multi-seed batches silently broken by parser.int() in request builder

2 participants