当前位置:   article > 正文

FunASR安装

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__
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

测试推理代码

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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

预期输出:

{'text': '欢迎大家来体验达摩院推出的语音识别模型'}
  • 1
  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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/288748
推荐阅读
相关标签
  

闽ICP备14008679号