modelscope / modelscope/FunASR

[安装] 昇腾 NPU 环境下 pip install funasr 可能替换 torch 导致 torch_npu 失效,建议提供对 NPU 友好的安装方式

Open
#3,707 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
20.4k
Forks
2k
Avg merge
4h 55m
Merged PRs (30d)
169

Description

环境
  • funasr:1.3.14
  • torch:2.10.0+cpu / torch_npu:2.10.0(昇腾 Atlas 300I Pro / 310P3,CANN 9.1.0-beta.1)
问题描述

昇腾 NPU 环境要求 torch 使用 CPU 版本,并与 torch_npu 严格配对
(如 torch 2.10.0+cpu + torch_npu 2.10.0)。默认依赖解析安装 funasr 时,
可能拉取/升级通用(CUDA)版 torch,静默破坏这一配对——之后 import torch_npu
会因 C++ 扩展不匹配而失败。

我们目前的规避方式(openEuler 24.03,容器内):

pip install funasr --no-deps -i <国内镜像>
pip install torch_complex kaldiio omegaconf librosa kaldi-native-fbank
editdistance jieba zhconv tgt umap-learn ... # 手动逐个补齐

这种做法容易出错:不少运行时依赖(kaldiio、omegaconf、torch_complex、
umap-learn、praat-parselmouth 等)很容易遗漏,只在 import 时才报
ModuleNotFoundError。

建议(任一均可)
  1. 提供依赖分组,如 pip install "funasr[npu]"(torch 视为环境自带,不强制版本);
  2. 或将依赖声明放宽到"已安装的 torch 不被替换"(避免触发升级的上限约束);
  3. 或补充文档《在昇腾 NPU 上安装》,列出 --no-deps 方式所需的完整运行时依赖清单。

如有需要,我们愿意贡献在 310P3 上实测验证过的完整依赖清单。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting FunASR's declared runtime dependencies and existing installation documentation. Reproduce installation with a preinstalled CPU torch and torch_npu pair, then verify that the pair is not replaced and all runtime imports work. Done means an NPU-friendly installation path or dependency group is documented and validated, including the dependencies currently listed in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.