Fix Qwen3-ASR hotwords handling#3477
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDocumentation link update in a .NET example and refinement to hotword prompt generation in Qwen3 ASR implementation. The hotwords feature now defaults to model-level configuration when stream-specific options are absent, with minor code reformatting applied to both files. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request implements a fallback to global hotwords in the Qwen3 ASR decoder and includes minor documentation and formatting improvements. A potential crash was identified in the C++ implementation where a null configuration value could be passed to a string constructor.
| stream->HasOption("hotwords") ? stream->GetOption("hotwords") | ||
| : qwen3_config.hotwords); |
There was a problem hiding this comment.
The logic correctly implements a fallback to the global qwen3_config.hotwords when no per-stream hotwords are provided. However, if qwen3_config.hotwords is a const char * (as defined in the C API struct SherpaOnnxOfflineQwen3ASRModelConfig) and it happens to be nullptr, this ternary expression will cause a crash when constructing the std::string argument for Qwen3FormatHotwordsForPrompt. While the C++ configuration usually initializes this to an empty string, adding a null check or ensuring it defaults to "" is safer.
Summary by CodeRabbit