f41089090e4c3c319d039e2fb9b975d4ce647d6c,train.py,,save_checkpoint,#Any#Any#Any#Any#Any#,277

Before Change


        for fn in checkpoints:
            if os.path.exists(fn):
                os.remove(fn)
        trainer.save_checkpoint(checkpoints[0], extra_state)
        for fn in checkpoints[1:]:
            os.symlink(os.path.basename(checkpoints[0]), fn)

    if not end_of_epoch and args.keep_interval_updates > 0:

After Change


        for fn in checkpoints:
            if os.path.exists(fn):
                os.remove(fn)
        if not end_of_epoch and args.keep_interval_updates > 0:
            for cp in checkpoints:
                trainer.save_checkpoint(cp, extra_state)
        else:
            trainer.save_checkpoint(checkpoints[0], extra_state)
            for fn in checkpoints[1:]:
                os.symlink(os.path.basename(checkpoints[0]), fn)

    if not end_of_epoch and args.keep_interval_updates > 0:
        // remove old checkpoints; checkpoints are sorted in descending order
        checkpoints = utils.checkpoint_paths(args.save_dir, pattern=r"checkpoint_\d+_(\d+)\.pt")
        for old_chk in checkpoints[args.keep_interval_updates:]:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: elbayadm/attn2d
Commit Name: f41089090e4c3c319d039e2fb9b975d4ce647d6c
Time: 2018-06-15
Author: alexei.b@gmail.com
File Name: train.py
Class Name:
Method Name: save_checkpoint


Project Name: pytorch/examples
Commit Name: 15e27719d75e35358555a27215665c797999740f
Time: 2018-12-04
Author: teng-li@users.noreply.github.com
File Name: imagenet/main.py
Class Name:
Method Name: main_worker