From 08fb63a017d28f327912429fb251709185fb6fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stardust=C2=B7=E5=87=8F?= Date: Tue, 5 Sep 2023 20:31:47 +0800 Subject: [PATCH] Update bert_gen.py --- bert_gen.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bert_gen.py b/bert_gen.py index 265d091..80a2695 100644 --- a/bert_gen.py +++ b/bert_gen.py @@ -14,7 +14,6 @@ def process_line(line): if torch.cuda.is_available(): gpu_id = rank % torch.cuda.device_count() device = torch.device(f"cuda:{gpu_id}") - #logger.info(f"Rank {rank} uses device {device}") wav_path, _, language_str, text, phones, tone, word2ph = line.strip().split("|") phone = phones.split(" ") tone = [int(i) for i in tone.split(" ")] @@ -36,9 +35,12 @@ def process_line(line): bert = torch.load(bert_path) assert bert.shape[-1] == len(phone) except Exception: - bert = get_bert(text, word2ph, language_str,device) - assert bert.shape[-1] == len(phone) - torch.save(bert, bert_path) + try: + bert = get_bert(text, word2ph, language_str,device) + assert bert.shape[-1] == len(phone) + torch.save(bert, bert_path) + except Exception: + print(text) if __name__ == "__main__":