modelscope-funasr这个问题怎么解决? demo ERROR. Real-time transcription service ONLY SUPPORT wav_format pcm.用的是funasr-runtime-resources/samples/audio/asr_example.wav
部署步骤
curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/funasr-runtime-deploy-offline-cpu-zh.sh
sudo bash funasr-runtime-deploy-offline-cpu-zh.sh install --workspace ./funasr-runtime-resources
python3 funasr_wss_client.py --host "127.0.0.1" --port 10098 --mode offline --audio_in "../audio/asr_example.wav" --output_dir .
在我们服务器上部署很多次, 都没问题。 昨天在客户环境部署。 同样的三条命令。 结果是
demo ERROR. Real-time transcription service ONLY SUPPORT wav_format pcm.
是wav 44字节头的原因。出错的: if wav_path.endswith(".pcm"):
with open(wav_path, "rb") as f:
audio_bytes = f.read()
else:
wav_format = "others"
with open(wav_path, "rb") as f:
audio_bytes = f.read()
正确的:if wav_path.endswith(".pcm"):
with open(wav_path, "rb") as f:
audio_bytes = f.read()
elif wav_path.endswith(".wav"):
import wave
with wave.open(wav_path, "rb") as wav_file:
params = wav_file.getparams()
sample_rate = wav_file.getframerate()
frames = wav_file.readframes(wav_file.getnframes())
audio_bytes = bytes(frames)
else:
wav_format = "others"
with open(wav_path, "rb") as f:
audio_bytes = f.read() 此回答整理自钉群“modelscope-funasr社区交流”