Repository navigation
Reduce HTDemucs inference overhead across backends - #790
Merged
Merged
Conversation
Owner
Author
|
133s input
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Both graph rewrites are enabled across backends, including Metal, without an opt-in flag. Only HTDemucs model files change; no framework, ggml, or server changes.
CUDA validation
Warm inference on the same 133-second stereo input, RTX 5090, eight CPU threads. C++ uses the Q8_0 package with default runtime storage; Python uses original weights with shifts=0 to match C++. No precision overrides.
About 56% less C++ inference time. Timings exclude HTTP serialization/transfer; the original baseline was measured earlier, not in an interleaved A/B run.
All four stems retain their lengths and finite samples. First and warm request WAVs are byte-identical. Compared with old C++, waveform cosine is 0.9999987/0.9999997 for drums/other and 0.99826/0.99758 for near-silent bass/vocals. Floating-point drift remains; this is not bit-exact parity.
CPU and Vulkan validation
Separate eight-second case, Q8_0 package, eight CPU threads, one first request followed by one warm server request per configuration.
Both produce four finite, nonzero stems with the expected lengths and byte-identical first/warm outputs. Vulkan is about 40% faster; CPU is about 7% slower.
The old CPU 2D-transpose implementation ignores the batch dimension that HTDemucs uses for time frames. The rewrite avoids that unsupported usage. Against official Python on this case, CPU drums/other cosine improves from 0.683/0.924 to 0.999974/0.999998. Retaining the old convolution while changing only GroupNorm reproduces the old output. CPU timing therefore compares paths with different correctness, not equivalent output.
The near-silent bass/vocal stems also move closer to Python on CPU and Vulkan, but residual quantization/numerical differences remain. These are ordinary-settings output checks, not a universal parity guarantee.
Metal is enabled for both rewrites but untested. The six-stem model shares these paths but has not been measured or validated.
Fixes #785. No measured Metal speedup is claimed.