hf-hub-lightning icon indicating copy to clipboard operation
hf-hub-lightning copied to clipboard

Saving only the best models

Open Borda opened this issue 3 years ago • 1 comments

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:

Borda avatar Oct 27 '21 07:10 Borda

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.

nateraw avatar Oct 27 '21 16:10 nateraw