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

add blank scale for wfst decoding #1646

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

simonwang517
Copy link
Contributor

blank scale can smooth wfst decoding score

@xingchensong
Copy link
Member

thx, any numbers?

@simonwang517
Copy link
Contributor Author

1wh-unified-conformer-blankscale cn_test en_test
1.0 5.7 20.25
0.2 5.48 19.07
0.3 5.42 19.06
0.4 5.44 19.14

@xingchensong xingchensong requested a review from robin1001 January 8, 2023 06:25
@@ -107,6 +107,10 @@ DecodeState AsrDecoder::AdvanceDecoding(bool block) {
std::vector<std::vector<float>> ctc_log_probs;
model_->ForwardEncoder(chunk_feats, &ctc_log_probs);
int forward_time = timer.Elapsed();
for (int i = 0; i < ctc_log_probs.size(); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (opts_.ctc_wfst_search_opts.blank_scale != 1.0) {
 for (int i = 0; i < ctc_log_probs.size(); i++) {
      ctc_log_probs[i][0] = ctc_log_probs[i][0]
              + std::log(opts_.ctc_wfst_search_opts.blank_scale);
  }
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simonwang517 please fix the logic as above to avoid useless computation when blank_scale is 1.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robin1001 have updated code to avoid useless computation

@robin1001 robin1001 merged commit 762954b into wenet-e2e:main Jan 9, 2023
@simonwang517 simonwang517 deleted the wsm_blankscale branch January 9, 2023 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants