I believe this still does not answer the original question.
When on_save_checkpoint
is called, how do I tell if the checkpoint will be saved in self.best_model_path
or self.last_model_path
?
(In the very common case where we are saving both the best and the last model)
For my use-case, I’m using the following:
def on_save_checkpoint(self, checkpoint):
filepath = reach("filepath")
where reach
is defined as:
def reach(name):
for f in inspect.stack():
if name in f[0].f_locals:
return f[0].f_locals[name]
return None