omnilingual_asr在Nvidia Spark DGX中部署

1 容器选择

目前至少需要/pytorch:25.09 才支持Nvidia Spark DGX,内置Python版本为3.12.3,torch版本2.9。

进入容器并进行后续的步骤。

shell 复制代码
docker run --rm -it --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 nvcr.io/nvidia/pytorch:25.09-py3  

2 编译fairseq2

从依赖可知omnilingual_asr 依赖fairseq2==0.6 。但是fairseq2没有对应的ARM版本,需要自行编译。

2.1 环境准备

参考官方源码编译教程,并进行改良。

shell 复制代码
git clone --recurse-submodules https://github.com/facebookresearch/fairseq2.git
cd fairseq2
git checkout v0.6.0
apt-get update
apt install libsndfile-dev
pip install -r native/python/requirements-build.txt

2.2 编译

shell 复制代码
export TORCH_CUDA_ARCH_LIST="10.0 11.0"
cd native
cmake -GNinja \
      -DCMAKE_CUDA_ARCHITECTURES="100" \
      -DFAIRSEQ2N_USE_CUDA=ON \
      -DFAIRSEQ2N_CUDA_ARCH_LIST="10.0" \
      -DCMAKE_BUILD_TYPE=Release \
      -B build
      
cmake --build build

cd python
pip install . --no-build-isolation
cd ../../
pip install . --no-build-isolation

3 安装omnilingual_asr

最新版本官方没有发布arm版本,需要自己直接去官网下发布版本。

然后正常安装即可。顺便还原psutil和huggingface-hub版本避免其他依赖被破坏。

shell 复制代码
pip install .
pip install psutil==7.0.0 huggingface-hub==1.9.2 

4 安装配套的torchaudio

默认会安装到与实际版本不配套的torchaudio,程序无法正常运行。

由于torch版本是2.9的修改版,普通pip安装不到配套的torchaudio,需要从源码编译安装。

官网下载2.9.0对应的release,然后安装

shell 复制代码
pip wheel -v . --no-build-isolation --no-deps -w dist

做出来wheel包方便后续再用。

由于实际上写着依赖torch==2.9.0,会破坏容器内的特殊torch,安装wheel包时也需要不安装依赖

shell 复制代码
pip install torchaudio-2.9.0-cp312-cp312-linux_aarch64.whl --no-deps 
相关推荐
always_TT15 分钟前
【Python requirements.txt 依赖管理】
开发语言·python
bamb0044 分钟前
一个项目带你入门AI应用开发05
python
Python私教1 小时前
Django 6.1 邮件配置大改:旧项目如何平稳升级?
后端·python·django
Python私教1 小时前
Django 6.1 升级避坑:数据库版本不兼容怎么解决?
后端·python·django
Python私教1 小时前
Django 接口开发实测:新手还需要使用 REST 框架吗?
后端·python·django
名字还没想好☜1 小时前
Python concurrent.futures 实战:用 ThreadPoolExecutor 并发处理 + as_completed 收结果
数据库·python·php·并发
爱码小白2 小时前
importlib模块
开发语言·前端·python
axinawang2 小时前
第25课 for循环的应用
python
逻极2 小时前
FastAPI 实战:从入门到自动化文档,如何把API开发效率提升200%
python·api·fastapi·swagger·异步
半兽先生3 小时前
大模型技术开发与应用——5.大模型Agent开发(CrewAI)
大数据·人工智能·python·机器学习·ai