-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add blank_penalty for offline transducer #542
Changes from 1 commit
b929124
a4fc90b
b1c61cf
d1992b8
5d16622
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,10 @@ OfflineTransducerGreedySearchDecoder::Decode(Ort::Value encoder_out, | |
start += n; | ||
Ort::Value logit = model_->RunJoiner(std::move(cur_encoder_out), | ||
std::move(cur_decoder_out)); | ||
const float *p_logit = logit.GetTensorData<float>(); | ||
float *p_logit = logit.GetTensorMutableData<float>(); | ||
if (blank_penalty_ > 0.0) { | ||
p_logit[0] -= blank_penalty_; // assuming blank id is 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we also consider the case when
We need to process p_logit[vocab_size*i + 0]
// for in range(n) You can move this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
||
} | ||
bool emitted = false; | ||
for (int32_t i = 0; i != n; ++i) { | ||
auto y = static_cast<int32_t>(std::distance( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update
sherpa-onnx/sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
Line 38 in b929124
to add an extra argument
and also add docstring for it?
Note that you need to pass the argument to
sherpa-onnx/sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
Line 114 in b929124
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
I also noticed there is no docstring for the hotwords params, as well as the max_active_paths was not propagated into the
OfflineRecognizerConfig
. Should I raise two seperate PR to fix these?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please do that in a separate PR. Thanks!