安装pytorch1.0
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge
报错,执行下面再重执行安装
conda install conda=23.10.0
安装cv2:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
安装tensorboard
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorboardX
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorboard
安装torch-tb-profiler
pip install torch-tb-profiler
安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple plyfile
如何执行shell脚本
在终端中输入“chmod +x 文件名.sh”,将文件设置为可执行文件。
在终端中输入“./文件名.sh”,即可运行shell脚本。
torch.distributed.launch被弃用,考虑使用torchrun模块进行替换。
解决方案:
将训练脚本中的torch.distributed.launch替换为torchrun。例如,如果原始命令如下
python -m torch.distributed.launch --nproc_per_node=2 train.py
将其修改为下面的命令:
python -m torch.distributed.run --use-env --nproc_per_node=2 train.py
torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 2344619) of binary: /home/vgg/anaco
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 1105295) of binary: /home/vgg/anaconda3/envs/kunpython37/bin/python
解决方案:
在dataloader时参数shuffle默认False即可
单卡跑就行,解决方案看5
解决方案
卸载掉progressbar2和progressbar模块重装
pip uninstall progressbar2
pip uninstall progressbar
重装,建议安装低版本的progressbar2
pip install progressbar2==3.51
pip install progressbar==2.1
问题原因:参与运算的变量不在同一个gpu上,考虑将所有数据移动到同一个gpu上运行,或者干脆使用单卡运行,在训练脚本中改为:就是单卡跑
CUDA_VISIBLE_DEVICES=0,--nproc_per_node=1
使用查看显卡空间
gpustat
然后切换成有空的显卡
CUDA_VISIBLE_DEVICES=有空的显卡号
找到.log文件夹下的检查点文件,复制路径
在主函数里找到训练
找到训练里的第10个参数resume,添加default = ‘检查点文件地址’
如下: