Add missing parentheses in regex expression
Summary:
The regex pattern without parentheses is not correct. The checkpoints are not sorted in descending order
Pull Request resolved:
@@ -325,7 +325,7 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss):
if args.keep_last_epochs > 0:
# remove old epoch checkpoints; checkpoints are sorted in descending order
- checkpoints = utils.checkpoint_paths(args.save_dir, pattern=r'checkpoint\d+\.pt')
+ checkpoints = utils.checkpoint_paths(args.save_dir, pattern=r'checkpoint(\d+)\.pt')
for old_chk in checkpoints[args.keep_last_epochs:]:
if os.path.lexists(old_chk):
os.remove(old_chk)
