Thank you @vfdev-5! Not sure how this works… I tried accessing trainer.state.epoch (before trainer.run) and state was None. Is this what that lambda does? Accessing trainer engine state after trainer.run?
once every 2 epoch, ckpt_handler is triggered to save what to save. Its argument global_step_transform is an optional callable that
global step transform function to output a desired global step. Input of the function is (engine, event_name). Output of function should be an integer. Default is None, global_step based on attached engine. If provided, uses function output as global_step.
So it is just executed during the training, where trainer’s state is initialized and can be used.