当前位置: 首页 > 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.dtcms.com/a/313374.html

相关文章:

  • C语言数据结构(6)贪吃蛇项目1.贪吃蛇项目介绍
  • 有限元方法中的数值技术:三角矩阵求解
  • Vulnhub Corrosion2靶机复现
  • 机器人抓取流程介绍与实现——机器人抓取系统基础系列(七)
  • 腾讯云CentOS7镜像配置指南
  • Pytorch实现一个简单的贝叶斯卷积神经网络模型
  • Java 中也存在类似的“直接引用”“浅拷贝”和“深拷贝”
  • [创业之路-530]:创业公司五维架构设计:借鉴国家治理智慧,打造敏捷型组织生态
  • mysql8.0集群技术
  • 第13章 文件输入/输出
  • 知识蒸馏 - 基于KL散度的知识蒸馏 HelloWorld 示例 KL散度公式对应
  • 文件拷贝-代码
  • Doris json_contains 查询报错
  • 数据结构总纲以及单向链表详解:
  • 【LeetCode刷题指南】--对称二叉树,另一颗树的子树
  • [创业之路-531]:知识、技能、技术、科学之间的区别以及它们对于职业的选择的指导作用?
  • 【OpenGL】LearnOpenGL学习笔记02 - 绘制三角形、矩形
  • 13-day10生成式任务
  • 基于MBA与BP神经网络分类模型的特征选择方法研究(Python实现)
  • 在ANSYS Maxwell中对永磁体无线充电进行建模
  • 【大模型核心技术】Agent 理论与实战
  • 【设计模式】5.代理模式
  • Manus AI与多语言手写识别
  • 什么是“痛苦指数”(Misery Index)?
  • 如何获取网页中点击按钮跳转后的链接呢
  • 在 Cursor 中设置浅色背景和中文界面
  • 抽奖系统中 Logback 的日志配置文件说明
  • 03.一键编译安装Redis脚本
  • 【MySQL】MySQL 中的数据排序是怎么实现的?
  • 深入理解流式输出:原理、应用与大模型聊天软件中的实现