FunASR安装

目录

  1. 创建和激活conda环境
    conda create -n funasr python=3.8
    conda activate funasr
  2. 安装pytorch torchaudio等
    conda install pytorch=1.12.1 torchvision torchaudio cudatoolkit=11.3 -c pytorch -c conda-forge
    linux系统上cuda是11.6
  3. 安装modelscope相关工具
    pip install “modelscope[audio_asr]” -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
  4. 克隆FunAsr项目并安装依赖
    git clone https://github.com/alibaba/FunASR.git
    cd FunASR
    pip install --editable ./
  5. 测试
    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='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav')
print(rec_result)

预期输出:

{'text': '欢迎大家来体验达摩院推出的语音识别模型'}
  1. 最终环境记录

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

  1. 卸载
    funasr pip uninstall funasr

  2. 更新

pip install “modelscope[audio]” --upgrade -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
pip install “funasr” --upgrade -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

你可能感兴趣的:(深度学习,pytorch)