hf-hub-lightning
hf-hub-lightning copied to clipboard
Saving only the best models
Hi, just curious how it is interconnected with PL internal checkpointing callback, and saving only the best models according to some given monitoring criteria like max validation accuracy etc.?
# saves a file like: my/path/sample-mnist-epoch=02-val_loss=0.32.ckpt
checkpoint_callback = ModelCheckpoint(
monitor="val_loss",
dirpath="my/path/",
filename="sample-mnist-{epoch:02d}-{val_loss:.2f}",
save_top_k=3,
mode="min",
)
trainer = Trainer(callbacks=[checkpoint_callback])
see: https://pytorch-lightning.readthedocs.io/en/latest/common/weights_loading.html
Thx :rabbit:
Yeah, I think we'll want to more closely mirror the logic of ModelCheckpoint
here. I was going to do that, but got lazy 😅
Thx for documenting this one, its high on my list of things to do here.