Release Rust package for offline/online speech denoiser - #3328
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
📝 WalkthroughWalkthroughThis PR restructures the speech denoising APIs across Kotlin and Rust by extracting DenoisedAudio to a dedicated Kotlin file, reorganizing Rust denoiser implementations into separate modules, and updating version dependencies to 0.1.11 across Rust packages and examples. Changes
Possibly related PRs
Suggested labels
Poem
🎯 4 (Complex) | ⏱️ ~45 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on expanding the speech processing capabilities by releasing new Rust packages for offline and online speech denoisers. It also includes a refactoring effort in the Kotlin API to improve code structure and maintainability, ensuring that the denoising functionalities are well-integrated and easily accessible across different platforms. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces Rust packages for both offline and online speech denoisers. It includes adding new Rust files for these features, refactoring existing Rust and Kotlin code to separate concerns, and updating version numbers across several Cargo.toml and Cargo.lock files for the new release. The changes are well-structured. I've found a couple of minor issues regarding potential integer overflows in the new Rust code, which could occur with very large inputs.
| sys::SherpaOnnxOfflineSpeechDenoiserRun( | ||
| self.ptr, | ||
| samples_ptr, | ||
| samples.len() as i32, |
There was a problem hiding this comment.
The cast samples.len() as i32 could lead to an integer overflow if the number of samples exceeds i32::MAX. This would wrap in release builds, leading to incorrect behavior. It's safer to use try_into() to handle this case, which will panic on overflow instead of silently producing incorrect results.
| samples.len() as i32, | |
| samples.len().try_into().expect("number of samples should fit in a 32-bit integer"), |
| sys::SherpaOnnxOnlineSpeechDenoiserRun( | ||
| self.ptr, | ||
| samples_ptr, | ||
| samples.len() as i32, |
There was a problem hiding this comment.
Similar to the offline denoiser, the cast samples.len() as i32 could lead to an integer overflow if the number of samples exceeds i32::MAX. This would wrap in release builds, leading to incorrect behavior. It's safer to use try_into() to handle this case, which will panic on overflow instead of silently producing incorrect results.
| samples.len() as i32, | |
| samples.len().try_into().expect("number of samples should fit in a 32-bit integer"), |
Summary by CodeRabbit
Release Notes
New Features
Refactor
Chores