在Linux环境下,如果你想要用上一次的checkpoint文件继续训练,你可以在你的dist_train.sh脚本中设置--resume_from参数。这个参数指定了checkpoint文件的路径,训练会从该文件的状态继续进行。
例如,如果你的checkpoint文件名为last_checkpoint.pth,并且位于当前目录下,你可以修改你的dist_train.sh脚本,在运行命令中添加--resume_from ./last_checkpoint.pth。
假设你的原始训练命令是这样的:


python -m torch.distributed.launch \
--nproc_per_node=$NGPUS \
--master_port=$PORT \
your_train_script.py \
[other arguments]
或者 如果是linux控制台的话,加个resum-from /path/to/latest.pth就可以了
原来的命令
sh tools/dist_train.sh configs/maskclip_plus/zero_shot/maskclip_plus_r50_deeplabv2_r101-d8_512x512_80k_coco-stuff164k.py 2
后来的命令,checkpoint一般保存至workdir中,找到对应的文件就好
sh tools/dist_train.sh configs/maskclip_plus/zero_shot/maskclip_plus_r50_deeplabv2_r101-d8_512x512_80k_coco-stuff164k.py 2 --resume-from /opt/10T/home/asc005/YangMingxiang/MaskCLIP/work_dirs/maskclip_plus_r50_deeplabv2_r101-d8_512x512_80k_coco-stuff164k/latest.pth