Skip to content
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

[runtime] add blank_sacle in ctc_endpoint #2374

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/core/decoder/ctc_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool CtcEndpoint::IsEndpoint(
float blank_prob = expf(logp_t[config_.blank]);

num_frames_decoded_++;
if (blank_prob > config_.blank_threshold) {
if (blank_prob > config_.blank_threshold * config_.blank_scale) {
num_frames_trailing_blank_++;
} else {
num_frames_trailing_blank_ = 0;
Expand Down
1 change: 1 addition & 0 deletions runtime/core/decoder/ctc_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct CtcEndpointRule {
struct CtcEndpointConfig {
/// We consider blank as silence for purposes of endpointing.
int blank = 0; // blank id
float blank_scale = 1.0; // blank scale
float blank_threshold = 0.8; // blank threshold to be silence
/// We support three rules. We terminate decoding if ANY of these rules
/// evaluates to "true". If you want to add more rules, do it by changing this
Expand Down
1 change: 1 addition & 0 deletions runtime/core/decoder/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ std::shared_ptr<DecodeOptions> InitDecodeOptionsFromFlags() {
decode_config->ctc_prefix_search_opts.second_beam_size = FLAGS_nbest;
decode_config->ctc_prefix_search_opts.blank = FLAGS_blank_id;
decode_config->ctc_endpoint_config.blank = FLAGS_blank_id;
decode_config->ctc_endpoint_config.blank_scale = FLAGS_blank_scale;
return decode_config;
}

Expand Down
Loading