Fix initial tokens to decoding (#246)

This commit is contained in:
Fangjun Kuang
2023-08-09 12:33:47 +08:00
committed by GitHub
parent aeb112dd06
commit aa48b76d4b
5 changed files with 10 additions and 5 deletions

View File

@@ -30,8 +30,9 @@ OfflineTransducerGreedySearchDecoder::Decode(Ort::Value encoder_out,
std::vector<OfflineTransducerDecoderResult> ans(batch_size);
for (auto &r : ans) {
r.tokens.resize(context_size, -1);
// 0 is the ID of the blank token
r.tokens.resize(context_size, 0);
r.tokens.back() = 0;
}
auto decoder_input = model_->BuildDecoderInput(ans, ans.size());