Ubuntu 服务器训练程序,断网也能训练
方法:
nohup python -u train_resNet.py &
其中,train_resNet.py为要训练的文件;-u 表示实时输出;&表示将train_resNet.py 输出的所有内容保存到默认的文件中,默认文件名为nohup.out
- 自定义输出文件名
nohup python -u train_resNet.py --resume epoch_1.pth \ --num_class 20 \
> output/train.log 2>&1
若train_resNet.py带有参数
nohup python -u train_resNet.py --resume epoch_1.pth \ --num_class 20 \ &
其中,–resume epoch_1.pth与–num_class 20为分别为对应需要带的参数名与参数值(以两个参数为例),需在每个参数后面添加.
- 如何使用命令查看nohup.out的内容:
tail -f nohup.out
其中,nohup.out为默认输出的文件