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