总体说明
环境配置
环境依赖库参见如下:
- CANN (version >= 7.3.0.1.231:8.0.RC2)
- python(version == 3.9)
- torch(version >= 2.0.1)
- torch_npu(version >= 2.0.1.post4)
- numpy(version >= 1.25.2)
- scikit-learn(version >= 1.4.1.post1)
- tqdm(version ≥ 4.66.1)
可通过pip install命令安装,命令执行参考如下。
pip install numpy tqdm scikit-learn torch_npu torch
执行训练脚本前,先执行如下命令设置环境变量。
source /usr/local/Ascend/ascend-toolkit/set_env.sh
注意事项
- 若import torch,torch_npu遇到下面的错误:
.../libgomp.so: cannot allocate memory in static TLS block
请执行export LD_PRELOAD=.../libgomp.so(报错中出现的libgomp.so路径)
- 若安装numpy出现pip无法安装如下依赖时:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. auto-tune 0.1.0 requires decorator, which is not installed. dataflow 0.0.1 requires jinja2, which is not installed. opc-tool 0.1.0 requires attrs, which is not installed. opc-tool 0.1.0 requires decorator, which is not installed. opc-tool 0.1.0 requires psutil, which is not installed. schedule-search 0.0.1 requires absl-py, which is not installed. schedule-search 0.0.1 requires decorator, which is not installed. te 0.4.0 requires attrs, which is not installed. te 0.4.0 requires cloudpickle, which is not installed. te 0.4.0 requires decorator, which is not installed. te 0.4.0 requires ml-dtypes, which is not installed. te 0.4.0 requires psutil, which is not installed. te 0.4.0 requires scipy, which is not installed. te 0.4.0 requires tornado, which is not installed.
请执行以下命令。pip install attrs cloudpickle decorator jinja2 ml-dtypes psutil scipy tornado absl-py
- 若训练码本遇到以下问题:
OpenBLAS warning: precompiled NUM_THREADS exceeded, adding auxiliary array for thread metadata. Segmentation fault (core dumped)
请执行:export OPENBLAS_NUM_THREADS=1
父主题: VSTAR生成码本文件