Add streaming GTCRN speech enhancement crate (ONNX via tract)#2
Open
czoli1976 wants to merge 3 commits into
Open
Add streaming GTCRN speech enhancement crate (ONNX via tract)#2czoli1976 wants to merge 3 commits into
czoli1976 wants to merge 3 commits into
Conversation
New `gtcrn` workspace crate runs the streaming GTCRN model frame-by-frame through tract-onnx (sonos/tract main): optimized plan, a single reused SimpleState, zero-copy TValue cache cycling, and a sqrt-Hann STFT/ISTFT front end matching the reference. Output matches the reference enh.wav at 0.9966 correlation. Includes a CLI (gtcrn-enhance) with RTF reporting and a per-node profiler example. https://claude.ai/code/session_015Swk2UYJHW24eCpZVuTkdG
The streaming cache updates export as ScatterNd nodes whose indices are compile-time constants. tract's generic ScatterNd walks every scattered element through dynamic ndarray views, dominating per-frame cost (~73%). Add a graph-rewrite pass (rewrite::replace_const_scatternd) that precomputes flat (dst, src) block offsets once and lowers each such ScatterNd to a custom FastScatterConst op doing a few copy_from_slice calls. All 18 nodes convert; output is bit-identical, and per-frame time drops 13.7ms -> 4.2ms (RTF ~0.85 -> ~0.24 on this container). The profiler example applies the pass too. https://claude.ai/code/session_015Swk2UYJHW24eCpZVuTkdG
Mirrors the onnxruntime measurement methodology (pure per-frame state.run loop, no STFT, warmup + best-of-5) so tract vs onnxruntime RTF can be compared apples-to-apples. Confirms ~0.23 RTF after the ScatterNd rewrite. https://claude.ai/code/session_015Swk2UYJHW24eCpZVuTkdG
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.
New
gtcrnworkspace crate runs the streaming GTCRN model frame-by-framethrough tract-onnx (sonos/tract main): optimized plan, a single reused
SimpleState, zero-copy TValue cache cycling, and a sqrt-Hann STFT/ISTFT
front end matching the reference. Output matches the reference enh.wav at
0.9966 correlation. Includes a CLI (gtcrn-enhance) with RTF reporting and a
per-node profiler example.
https://claude.ai/code/session_015Swk2UYJHW24eCpZVuTkdG