Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

feat(separator): spectral-core stable switch — generation 8 + waveform path deletion (#172 PR 5) (#197)

2 months ago

b416cdf
Authored
Davy7/25/2026, 1:39:28 PM
* feat(catalog): advance the embedded snapshot to generation 8 (spectral-core stable)

Byte-verified copy of the published infra-2026-07-25-005 manifest
(sha c75a7721…, 70567 bytes) plus the matching stable pointer.
resolve_model / resolve-model.mjs now select htdemucs.spectral.fp32.onnx
(209.5 MB) for the htdemucs variant. Merge is gated on the five-target
candidate validation and the models-side stable promotion.

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

* refactor(separator): delete the waveform production path (#172 PR 5)

The spectral-core session is now the only production separation path.
Remove the waveform graph transform/layout adapters, dense-DFT output-
contract detection, and fallback selection so no dual production path
remains.

Production code:
- model.rs: `tensor_interface_from_metadata` becomes
  `ensure_spectral_core_metadata`, which refuses absent/`waveform`/
  unknown declarations before any ORT session is created ("waveform-
  interface models are no longer supported; install a spectral-core
  bundle from the catalog"). Delete the `TensorInterface` enum and make
  `LoadedModel.spectral` a mandatory verified interface.
- inference.rs: delete `ModelOutputContract`, output-contract
  detection/classification, `process_two_stem_chunk`/
  `process_four_stem_chunk`/`read_four_stems_into`,
  `deinterleave_to_interleaved`, `configure_model_inputs`/
  `build_session_inputs`, and the shape-heuristic helpers.
  `separate_streaming` dispatches straight into the spectral session;
  the chunk schedule, cancellation, flush, and progress are unchanged.
- preprocess.rs: `target_frame_count` returns the fixed spectral window;
  delete the rank-3 waveform fallback and `PreparedModelInput`/
  `prepare_model_input*`.
- workspace.rs: delete the `auxiliary_inputs`/`audio_input_name` input
  mechanism, the `accompaniment_scratch` buffer and its helpers, and the
  waveform `input_shape` tensor shape.
- spectral_session.rs: drop the waveform-equivalence unit test (the
  waveform path can no longer load).

Preserved invariants: StemMode semantics (TwoStem premixes the
accompaniment in the spectral domain; FourStem composes four sources),
50% overlap OLA, and interrupted runs always restarting from chunk 0.

catalog.rs: update the gen-8 resolution test — the raw spectral delivery
is now htdemucs's smallest non-deprecated artifact. The catalog gate
still accepts both `waveform` and `spectral-core` so existing manifests
parse; only runtime loading of waveform models is refused.

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

* test(separator): migrate integration tests to the spectral path (#172 PR 5)

CI now provisions the spectral-core catalog model, so the streaming
integration tests run the spectral path directly through
`default_model_path()`. The phase3 inference/job flows are path-agnostic
and needed no change; this migrates the tests that referenced the
removed waveform surface:

- phase3_preprocess.rs: drop the `prepare_model_input*` tests (waveform-
  only channels-first tensor); keep the sample-rate resampling test.
- phase7_spectral_session.rs: remove the waveform cross-path comparison
  (`assert_stems_close` against `default_model_path`) and the
  `TensorInterface` assertion; keep the spectral end-to-end + sanity
  tests and the cancellation/restart-from-zero contract.
- phase7_spectral_bench.rs: drop the `TensorInterface` assertion and read
  the now-mandatory `spectral` interface directly.

The `OPENKARA_SPECTRAL_MODEL` gate is preserved for phase7 (skipped when
unset); the migrated phase3 tests do not need it. Preserved invariants:
StemMode semantics, 50% overlap, and cancellation restarting from
chunk 0.

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

* fix(catalog): resolution only selects loadable spectral-core artifacts

Adversarial review of the stable switch caught a confirmed dead end:
resolve_model picked the smallest non-deprecated artifact by size with
no tensor-interface filter, and for the fine-tuned variant the 654 MB
waveform dual archive is smaller than the 839 MB spectral delivery —
the app would download a model the sole remaining load path then
refuses, with no in-app recovery (re-resolution deterministically picks
the same artifact). The default variant only worked because its
spectral delivery happens to be the smallest.

resolve_model and its JS mirror (resolve-model.mjs) now restrict
candidates to tensor_interface == spectral-core; the embedded-snapshot
resolution test asserts the resolved artifact of EVERY variant is
loadable, and the resolver parity vitest mirrors the same rule (its
all-models-are-waveform assertion is updated for gen 8: manifests may
list waveform deliveries for compatibility, but they are never
resolution candidates).

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Parentf7afd8a

15 files changed
  • docs/references/contracts/model-bootstrap.md+5−4
  • docs/references/contracts/spectral.md+16−10
  • scripts/resolve-model.mjs+10−3
  • src-tauri/catalog/release-manifest.json+428−122
  • src-tauri/catalog/stable-pointer.json+7−7
  • src-tauri/src/separator/catalog.rs+36−12
  • src-tauri/src/separator/inference.rs+42−784
  • src-tauri/src/separator/model.rs
+79
−84
  • src-tauri/src/separator/preprocess.rs+6−82
  • src-tauri/src/separator/spectral_session.rs+0−187
  • src-tauri/src/separator/workspace.rs+8−106
  • src-tauri/tests/phase3_preprocess.rs+1−64
  • src-tauri/tests/phase7_spectral_bench.rs+3−8
  • src-tauri/tests/phase7_spectral_session.rs+12−65
  • tests/model-resolver-parity.test.ts+28−7