目录
- 创建和激活conda环境
conda create -n funasr python=3.8
conda activate funasr - 安装pytorch torchaudio等
conda install pytorch=1.12.1 torchvision torchaudio cudatoolkit=11.3 -c pytorch -c conda-forge
linux系统上cuda是11.6 - 安装modelscope相关工具
pip install “modelscope[audio_asr]” -f /releases/ - 克隆FunAsr项目并安装依赖
git clone /alibaba/
cd FunASR
pip install --editable ./ - 测试
python
import torch
torch.__version__
torch.cuda.is_available()
import modelscope
import funasr
modelscope.__version__
funasr.__version__
测试推理代码
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
inference_pipeline = pipeline(
task=Tasks.auto_speech_recognition,
model='damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')
rec_result = inference_pipeline(audio_in='/ics/MaaS/ASR/test_audio/asr_example_zh.wav')
print(rec_result)
预期输出:
{'text': '欢迎大家来体验达摩院推出的语音识别模型'}
- 最终环境记录
python=3.8 pytorch=1.12.1 cudatoolkit=11.3 modelscope=1.3.0 funasr=0.2.1
备注:如果克隆不下来FunAsr,
apt-get update
apt-get install libcurl4-openssl-dev
-
卸载
funasr pip uninstall funasr -
更新
pip install “modelscope[audio]” --upgrade -f /releases/
pip install “funasr” --upgrade -f /releases/