Fix a bug for offline paraformer (#816)
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -96,3 +96,8 @@ spoken-language-identification-test-wavs
|
||||
my-release-key*
|
||||
vits-zh-hf-fanchen-C
|
||||
sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
|
||||
*.dll
|
||||
*.lib
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.zip
|
||||
|
||||
@@ -40,7 +40,7 @@ OfflineParaformerGreedySearchDecoder::Decode(
|
||||
}
|
||||
|
||||
if (us_cif_peak) {
|
||||
int32_t dim = us_cif_peak.GetTensorTypeAndShapeInfo().GetShape()[1];
|
||||
int32_t dim = us_cif_peak.GetTensorTypeAndShapeInfo().GetShape().back();
|
||||
|
||||
const auto *peak = us_cif_peak.GetTensorData<float>() + i * dim;
|
||||
std::vector<float> timestamps;
|
||||
@@ -57,7 +57,10 @@ OfflineParaformerGreedySearchDecoder::Decode(
|
||||
timestamps.push_back(k * scale);
|
||||
}
|
||||
}
|
||||
timestamps.pop_back();
|
||||
|
||||
if (!timestamps.empty()) {
|
||||
timestamps.pop_back();
|
||||
}
|
||||
|
||||
if (timestamps.size() == results[i].tokens.size()) {
|
||||
results[i].timestamps = std::move(timestamps);
|
||||
|
||||
Reference in New Issue
Block a user