AI开发平台MODELARTS-SparseDrive模型基于ModelArts Lite Server适配PyTorch NPU训练指导:步骤三:准备训练环境
步骤三:准备训练环境
假设步骤二:启动容器中挂载到容器中的目录container_work_dir为:/home/ma-user/work/,并且已包含AscendCloud-ACD-6.5.905-xxx.zip代码包。
- 安装mmcv源码。
# 卸载镜像内原有的mmcv pip uninstall mmcv -y cd /home/ma-user/work/ git clone -b 1.x https://github.com/open-mmlab/mmcv.git cd mmcv MMCV_WITH_OPS=1 FORCE_NPU=1 python setup.py install
- 安装Driving SDK。
请参考昇腾Driving SDK代码仓说明编译安装Driving SDK。
cd /home/ma-user/work/ git clone https://gitee.com/ascend/DrivingSDK.git -b master cd DrivingSDK git checkout f15a2ae1a5add006bbc941d889e8173fb2cf7102 pip install -r requirements.txt vim CMakePresets.json # 修改 "ENABLE_ONNX"选项: 为False bash ci/build.sh --python=3.10 # 按照镜像内python版本指定 pip install ./dist/mx_driving-*.whl
- 将获取到的代码包AscendCloud-ACD-6.5.905-xxx.zip解压,并进入代码包目录。
cd /home/ma-user/work/ unzip AscendCloud-ACD-6.5.905-*.zip # 解压 cd AscendCloudDriving-*/ - 下载代码,对原始模型代码仓应用patch文件,并安装依赖。
cd models/SparseDrive/ git clone https://github.com/swc-17/SparseDrive.git cp -rf ./test/ SparseDrive cp -rf SparseDrive.patch SparseDrive cd SparseDrive git checkout 52c4c05b6d446b710c8a12eb9fb19d698b33cb2b git apply --reject --whitespace=fix SparseDrive.patch pip install -r requirements.txt
- 修改motmetrics代码以适配python3.10。
vim /home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.10/site-packages/motmetrics/metrics.py # 调整第8行,修改前: # from collections import OrderedDict, Iterable # 修改后: from collections import OrderedDict from collections.abc import Iterable
下载AI开发平台MODELARTS用户手册完整版