From 5e63ac1e608d2e65bca08d71c49f13106fe9fa53 Mon Sep 17 00:00:00 2001 From: BarryKCL Date: Wed, 10 Aug 2022 18:58:36 +0800 Subject: [PATCH] Fix a bug in g2pW --- docs/source/reference.md | 3 +++ paddlespeech/t2s/frontend/g2pw/onnx_api.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/source/reference.md b/docs/source/reference.md index ed91c206..0d36d96f 100644 --- a/docs/source/reference.md +++ b/docs/source/reference.md @@ -40,3 +40,6 @@ We borrowed a lot of code from these repos to build `model` and `engine`, thanks * [ThreadPool](https://github.com/progschj/ThreadPool/blob/master/COPYING) - zlib License - ThreadPool + +* [g2pW](https://github.com/GitYCC/g2pW/blob/master/LICENCE) +- Apache-2.0 license diff --git a/paddlespeech/t2s/frontend/g2pw/onnx_api.py b/paddlespeech/t2s/frontend/g2pw/onnx_api.py index 188d9737..abd3a159 100644 --- a/paddlespeech/t2s/frontend/g2pw/onnx_api.py +++ b/paddlespeech/t2s/frontend/g2pw/onnx_api.py @@ -102,6 +102,9 @@ class G2PWOnnxConverter: sentences = translated_sentences texts, query_ids, sent_ids, partial_results = self._prepare_data(sentences) + if len(texts) == 0: + # sentences no polyphonic words + return partial_results onnx_input = prepare_onnx_input(self.tokenizer, self.labels, self.char2phonemes, self.chars, texts, query_ids, use_mask=self.config.use_mask, use_char_phoneme=self.config.use_char_phoneme, -- GitLab