max_epochs = 100
val_every_n_epochs = 1
checkpoint_callback = ModelCheckpoint(
# dirpath=checkpoints_path, # <--- specify this on the trainer itself for version control
filename="fa_classifier_{epoch:02d}",
every_n_epochs=val_every_n_epochs,
save_top_k=-1, # <--- this is important!
)
trainer = Trainer(
callbacks=[checkpoint_callback],
default_root_dir=checkpoints_path,
check_val_every_n_epoch=val_every_n_epochs,
max_epochs=max_epochs,
gpus=1
)
1条答案
按热度按时间xytpbqjk1#
这不会删除保存的检查点。