Fix a bug for multilingual ASR (#281)

This commit is contained in:
Fangjun Kuang
2023-08-17 10:43:26 +08:00
committed by GitHub
parent 54eca59f19
commit eb22b4845a
2 changed files with 5 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-onnx)
set(SHERPA_ONNX_VERSION "1.7.8")
set(SHERPA_ONNX_VERSION "1.7.9")
# Disable warning about
#

View File

@@ -136,8 +136,10 @@ OfflineWhisperGreedySearchDecoder::Decode(Ort::Value cross_k,
auto logits_shape = logits.GetTensorTypeAndShapeInfo().GetShape();
int32_t vocab_size = logits_shape[2];
int32_t max_token_id = static_cast<int32_t>(std::distance(
p_logits, std::max_element(p_logits, p_logits + vocab_size)));
const float *p_start = p_logits + (logits_shape[1] - 1) * vocab_size;
int32_t max_token_id = static_cast<int32_t>(
std::distance(p_start, std::max_element(p_start, p_start + vocab_size)));
int32_t n_text_ctx = model_->TextCtx();