当前位置: 首页 > news >正文

源代码本地安装funasr

源码部署FUNASR

1. 下载源代码

github

GitHub - modelscope/FunASR: A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.

gitee:https://gitee.com/mirrors/funasr/tree/main/

2. 源码安装

安装torch torchaudio(CPU版)

pip install torch==2.2.2+cpu torchaudio==2.2.2# 下载pytorch
https://pytorch.org/get-started/previous-versions/
# 命令
conda install pytorch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 cpuonly -c pytorch

源码安装

cd funasr/pip3 install -e ./

运行实例:

# 识别示例语音
funasr ++model=paraformer-en ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input="./asr_example_en.wav" +disable_update=True

在这里插入图片描述

3. 报错` File “/home/pywcc/miniconda3/envs/python3.10/lib/python3.10/ctypes/init.py”, line 374, in init
self._handle = _dlopen(self._name, mode)

OSError: libtorch_cuda.so: cannot open shared object file: No such file or directory`

# 下载示例语音,指定
wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_en.wav
4. 报错`File “/home/pywcc/funasr-main/funasr/models/fsmn_vad_streaming/model.py”, line 690, in inferenceaudio_sample = torch.cat((cache[“prev_samples”], audio_sample_list[0]))

TypeError: expected Tensor as element 1 in argument 0, but got str`

排查步骤

  • 检查按文件路径是否带“”,且是否源文件名称一致

TypeError: expected Tensor as element 1 in argument 0, but got str · Issue #1327 · modelscope/FunASR (github.com)

如语音文件名字是asr_example_en.wav而不是asr_example-en.wav

报错:A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.Traceback (most recent call last): File "/home/pywcc/miniconda3/envs/python3.10/bin/funasr", line 33, in <module> sys.exit(load_entry_point('funasr', 'console_scripts', 'funasr')()) File "/home/pywcc/miniconda3/envs/python3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /home/pywcc/miniconda3/envs/python3.10/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /opt/conda/conda-bld/pytorch_1711403233856/work/torch/csrc/utils/tensor_numpy.cpp:84.)

或者

File "/home/pywcc/funasr-main/funasr/frontends/wav_frontend.py", line 269, in apply_cmvn means = np.tile(cmvn[0:1, :dim], (frame, 1)) File "/home/pywcc/miniconda3/envs/python3.10/lib/python3.10/site-packages/numpy/lib/_shape_base_impl.py", line 1276, in tile c = _nx.array(A, copy=None, subok=True, ndmin=d) ValueError: object __array__ method not producing an array

解决办法:

  • 安装pip install numpy==1.24.0

  • 重新源码安装funasr

http://www.xdnf.cn/news/1238653.html

相关文章:

  • 【Linux网络编程基础--socket地址API】
  • 01数据结构-时间复杂度和空间复杂度
  • FreeRTOS源码分析三:列表数据结构
  • 线程锁-互斥、自旋、读写、原子操作、线程池
  • 江协科技STM32 14-1 WDG看门狗
  • Python篇---环境变量软件安装
  • 【视频内容创作】PR的关键帧动画
  • C++23 Concepts:用类型约束重构泛型编程的终极方案
  • k8s+isulad 国产化技术栈云原生技术栈搭建2-crictl
  • io_cancel系统调用及示例
  • 数据结构:单向链表的函数创建
  • 二叉树的锯齿形层次遍历
  • 思途JSP学习 0802(项目完整流程)
  • day 44 文件的规范书写与拆分
  • 《 ThreadLocal 工作机制深度解析:高并发场景的利与弊》
  • Spring+K8s+AI实战:3全栈开发指南
  • Redis实战(7)-- 高级特性 Redis Stream数据结构与基础命令
  • HCIE-Datacom题库_07_设备【道题】
  • kafka与其他消息队列(如 RabbitMQ, ActiveMQ)相比,有什么优缺点?
  • Qt-vs加载exe图标
  • 日常--详细介绍qt Designer常用快捷键(详细图文)
  • 其它IO函数
  • Fay数字人如何使用GPT-SOVITS进行TTS转换以及遇到的一些问题
  • 《基于通道注意力与空洞卷积的胸片肺气肿检测算法》论文解析
  • [硬件电路-138]:模拟电路 - 什么是正电源?什么是负电源?集成运放为什么有VCC+和VCC-
  • Python切片命名技术详解:提升代码可读性与维护性的专业实践
  • 2106. 摘水果
  • 关于assert()函数,eval()函数,include
  • 第N个泰波那契数
  • Spring lookup-method实现原理深度解析