From d393848a695622964ac1b5a7817fd4aee6ce99d8 Mon Sep 17 00:00:00 2001
From: hnluo <haoneng.lhn@alibaba-inc.com>
Date: 星期一, 26 六月 2023 17:26:52 +0800
Subject: [PATCH] Merge pull request #669 from alibaba-damo-academy/dev_lhn
---
funasr/bin/asr_inference_launch.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/funasr/bin/asr_inference_launch.py b/funasr/bin/asr_inference_launch.py
index 656a965..ce1f984 100644
--- a/funasr/bin/asr_inference_launch.py
+++ b/funasr/bin/asr_inference_launch.py
@@ -19,6 +19,7 @@
import numpy as np
import torch
import torchaudio
+import soundfile
import yaml
from typeguard import check_argument_types
@@ -863,7 +864,10 @@
raw_inputs = _load_bytes(data_path_and_name_and_type[0])
raw_inputs = torch.tensor(raw_inputs)
if data_path_and_name_and_type is not None and data_path_and_name_and_type[2] == "sound":
- raw_inputs = torchaudio.load(data_path_and_name_and_type[0])[0][0]
+ try:
+ raw_inputs = torchaudio.load(data_path_and_name_and_type[0])[0][0]
+ except:
+ raw_inputs = torch.tensor(soundfile.read(data_path_and_name_and_type[0])[0])
if data_path_and_name_and_type is None and raw_inputs is not None:
if isinstance(raw_inputs, np.ndarray):
raw_inputs = torch.tensor(raw_inputs)
--
Gitblit v1.9.1