Skip to content

fix: honor MSST MDXC inference defaults - #299

Open
HAGerox wants to merge 2 commits into
nomadkaraoke:mainfrom
HAGerox:fix-msst-config-semantics
Open

fix: honor MSST MDXC inference defaults#299
HAGerox wants to merge 2 commits into
nomadkaraoke:mainfrom
HAGerox:fix-msst-config-semantics

Conversation

@HAGerox

@HAGerox HAGerox commented Aug 12, 2026

Copy link
Copy Markdown

Summary

PAS currently ignores the MDXC/RoFormer inference defaults in a model's YAML unless the user happens to supply the same values manually. It also interprets RoFormer overlap in different units from the model configuration and MSST.

This PR makes PAS use the model YAML's inference.num_overlap and inference.batch_size values by default, while preserving explicit user overrides and retaining PAS's existing fallback values for older YAML files that do not contain them.

What was wrong

PAS was using the right-looking setting in the wrong way.

An MDXC model YAML can contain:

inference:
  num_overlap: 2
  batch_size: 1

In MSST, num_overlap describes how many overlapping prediction windows fit into a chunk. The distance between chunk starts is therefore calculated as:

step = chunk_size / num_overlap

For an 11-second chunk and num_overlap: 2, the next chunk starts 5.5 seconds later. That gives the intended 50% overlap.

PAS did two different things instead:

  1. Its API and CLI defaults supplied mdxc_overlap=8, so the model's YAML value was not used.
  2. The RoFormer path treated that value as a number of seconds and calculated the step as:
step = overlap * sample_rate

For the same 11-second chunk, PAS therefore interpreted 8 as an 8-second step. Only 3 seconds were shared between adjacent chunks, or about 27.3% overlap.

The numerical values were especially misleading because identical numbers meant very different schedules:

Value Intended MSST meaning Previous PAS RoFormer meaning
2 5.5-second step; 50% overlap 2-second step; 81.8% overlap
8 1.375-second step; 87.5% overlap 8-second step; 27.3% overlap

This meant PAS could appear substantially faster while not performing the inference schedule requested by the model author. It was doing less overlapping model work, which can also change separation quality.

Performance impact

Correcting the calculation significantly reduces the apparent throughput compared with the previous, non-equivalent PAS behavior.

For a 126.71-second test input using an 11-second RoFormer chunk:

  • Previous PAS overlap-8 behavior: 88.0 seconds, RTF 0.695
  • Correct model-config behavior: 207.03 seconds, RTF 1.634
  • A repeat with contiguous MPS inputs: 224.69 seconds, RTF 1.773

The previous schedule performed 16 model forwards, while the intended overlap-2 schedule performed 25. That is 56.25% more model inference work before accounting for device throughput, memory movement, or benchmark noise.

The two corrected runs varied enough that 207–225 seconds should be treated as an approximate range rather than a definitive stable benchmark. However, the direction of the performance change is expected: the old 88-second result was faster because PAS was not applying the requested overlap, not because it was processing an equivalent workload more efficiently.

Changes

  • Default MDXC overlap and batch size to "not explicitly supplied" rather than forcing PAS values before the model is loaded.
  • Resolve values in this order:
    1. explicit API/CLI/user override;
    2. model YAML (inference.num_overlap / inference.batch_size);
    3. existing PAS fallback (8 / 1) when the YAML does not specify a value.
  • Calculate the RoFormer step using MSST's overlap-divisor semantics:
step = chunk_size // self.overlap
  • Carry the optional behavior through the local CLI, remote client, Cloud Run, and Modal entry points.
  • Document the effective defaults.
  • Add tests for YAML defaults, explicit overrides, legacy fallbacks, remote parameter omission, and the actual RoFormer chunk schedule.

Scope

The incorrect seconds-based overlap calculation was in the RoFormer branch of the MDXC separator. The configuration precedence change applies to MDXC models so their existing YAML inference values are honored. Other architecture implementations are unchanged.

Testing

  • 293 passed, 7 skipped, 1 deselected
  • The deselected unit test downloads a model from GitHub and is unrelated to this change.
  • git diff --check passed.
  • Python compilation passed.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • MDXC separation now uses model-configured overlap and batch size when values aren’t provided.
    • Explicit settings remain supported through the CLI, API, and deployment endpoints.
    • Legacy models fall back to overlap 8 and batch size 1.
  • Bug Fixes

    • Improved MDXC chunk processing to consistently honor configured overlap.
    • Invalid non-positive overlap or batch-size values are now rejected.
  • Documentation

    • Updated CLI and parameter documentation to describe the new defaults and fallbacks.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

MDXC overlap and batch size now default to model inference metadata, with fallbacks of 8 and 1. Remote interfaces omit unset values, explicit overrides remain supported, and RoFormer chunk steps use the overlap divisor.

Changes

MDXC defaults and chunking

Layer / File(s) Summary
Configuration resolution and chunk scheduling
audio_separator/separator/..., tests/unit/test_mdxc_config.py, tests/unit/test_mdxc_roformer_chunking.py
MDXC resolves omitted values from model metadata, validates them, and uses chunk_size // overlap for RoFormer chunk steps. Tests cover overrides, fallbacks, invalid values, and chunk starts.

Remote parameter propagation

Layer / File(s) Summary
Remote parameter propagation
audio_separator/remote/..., tests/unit/test_remote_api_client.py
Remote APIs and deployment endpoints accept optional MDXC values. Request payloads omit unset values and include explicit overrides.

CLI and documentation defaults

Layer / File(s) Summary
CLI and documentation defaults
README.md, audio_separator/utils/cli.py, audio_separator/remote/cli.py, tests/unit/test_cli.py
CLI defaults and help text now describe model-configured values. README documentation uses None for unspecified parameters.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant RemoteAPI
  participant MDXCSeparator
  participant ModelConfig
  Caller->>RemoteAPI: submit optional overlap and batch_size
  RemoteAPI->>MDXCSeparator: pass omitted or explicit values
  MDXCSeparator->>ModelConfig: read inference settings
  ModelConfig-->>MDXCSeparator: return configured values or fallbacks
  MDXCSeparator-->>Caller: process audio with resolved settings
Loading

Poem

I’m a rabbit tuning chunks in a row,
With model-set values ready to go.
None means “look up,”
Overrides fill the cup,
And RoFormer steps neatly flow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: honoring MSST MDXC inference defaults.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@audio_separator/separator/architectures/mdxc_separator.py`:
- Around line 96-102: Validate the resolved values in the MDXC initialization
flow before assigning self.overlap and self.batch_size: use the inference
defaults for YAML null values, and reject any non-positive explicit or fallback
result before storing it. Apply the same validation to both settings and add
tests covering zero, negative, and null YAML values.

In `@audio_separator/separator/separator.py`:
- Line 128: Update Separator.__init__ so mdxc_params, mdx_params, vr_params, and
demucs_params default to None rather than shared dictionary objects, then
instantiate a fresh default dictionary for each parameter when its value is
omitted while preserving caller-provided dictionaries.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6eb653e8-54d2-401e-b9a5-5f59e8640e60

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe3540 and 14f1cb2.

📒 Files selected for processing (12)
  • README.md
  • audio_separator/remote/api_client.py
  • audio_separator/remote/cli.py
  • audio_separator/remote/deploy_cloudrun.py
  • audio_separator/remote/deploy_modal.py
  • audio_separator/separator/architectures/mdxc_separator.py
  • audio_separator/separator/separator.py
  • audio_separator/utils/cli.py
  • tests/unit/test_cli.py
  • tests/unit/test_mdxc_config.py
  • tests/unit/test_mdxc_roformer_chunking.py
  • tests/unit/test_remote_api_client.py

Comment thread audio_separator/separator/architectures/mdxc_separator.py Outdated
Comment thread audio_separator/separator/separator.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/unit/test_mdxc_config.py (1)

58-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the test name with the covered configuration sources.

Lines 61-68 validate both architecture and model inference values, but test_mdxc_rejects_non_positive_inference_values names only inference values. Rename it to test_mdxc_rejects_non_positive_config_values, or split the cases into source-specific tests.

Proposed rename
-def test_mdxc_rejects_non_positive_inference_values(arch_config, inference_config, message):
+def test_mdxc_rejects_non_positive_config_values(arch_config, inference_config, message):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/test_mdxc_config.py` around lines 58 - 73, Rename
test_mdxc_rejects_non_positive_inference_values to
test_mdxc_rejects_non_positive_config_values so the name accurately covers
invalid values from both architecture and inference configurations; leave the
parameterized cases unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unit/test_mdxc_config.py`:
- Around line 58-73: Rename test_mdxc_rejects_non_positive_inference_values to
test_mdxc_rejects_non_positive_config_values so the name accurately covers
invalid values from both architecture and inference configurations; leave the
parameterized cases unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04234348-0047-4fca-8f0b-2b8028fadf68

📥 Commits

Reviewing files that changed from the base of the PR and between 14f1cb2 and 535e87e.

📒 Files selected for processing (2)
  • audio_separator/separator/architectures/mdxc_separator.py
  • tests/unit/test_mdxc_config.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • audio_separator/separator/architectures/mdxc_separator.py

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