Closed Hyungson closed 1 week ago
我也遇到了同样的问题
我也遇到了同样的问题 save_checkpoint({"epoch": epoch + 1, "psnr": psnr, "ssim": ssim, "state_dict": g_model.state_dict(), "ema_state_dict": ema_g_model.state_dict() if ema_g_model is not None else None, "optimizer": g_optimizer.state_dict(), 'scheduler': g_scheduler.state_dict()}, f"gepoch{epoch + 1}.pth.tar", samples_dir, results_dir, "g_best.pth.tar", "g_last.pth.tar", is_best, is_last) save_checkpoint({"epoch": epoch + 1, "psnr": psnr, "ssim": ssim, "state_dict": d_model.state_dict(), "optimizer": d_optimizer.state_dict(), 'scheduler': d_scheduler.state_dict()}, f"depoch{epoch + 1}.pth.tar", samples_dir, results_dir, "d_best.pth.tar", "d_last.pth.tar", is_best, is_last)
i added state_dict
谢谢你的回复!
我已经解决了这个问题,主要原因是预训练模型的路径存在错误。
期待下次交流!
best wishes!
--
Computer Vision Research China Agricultural University Mina Han Mobile. 13103573112
在 2024-06-11 07:22:31,"임형빈(LYM-HYEUNGBIN)" @.***> 写道:
我也遇到了同样的问题
save_checkpoint({"epoch": epoch + 1, "psnr": psnr, "ssim": ssim, "state_dict": g_model.state_dict(), "ema_state_dict": ema_g_model.state_dict() if ema_g_model is not None else None, "optimizer": g_optimizer.state_dict(), 'scheduler': g_scheduler.state_dict()}, f"gepoch{epoch + 1}.pth.tar", samples_dir, results_dir, "g_best.pth.tar", "g_last.pth.tar", is_best, is_last) save_checkpoint({"epoch": epoch + 1, "psnr": psnr, "ssim": ssim, "state_dict": d_model.state_dict(), "optimizer": d_optimizer.state_dict(), 'scheduler': d_scheduler.state_dict()},
f"d_epoch_{epoch + 1}.pth.tar",
samples_dir,
results_dir,
"d_best.pth.tar",
"d_last.pth.tar",
is_best,
is_last)
i added state_dict
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
hi, i tried to resume train srgan, but there is no scheduler at saving checkpoint. Is this my issue, or code issue?
File "/home/work/dacon/srgan/train_gan.py", line 98, in main g_model, ema_g_model, start_epoch, best_psnr, best_ssim, g_optimizer, g_scheduler = load_resume_state_dict( File "/home/work/dacon/srgan/utils.py", line 165, in load_resume_state_dict scheduler.load_state_dict(checkpoint["scheduler"]) KeyError: 'scheduler'