@@ -492,7 +492,7 @@ def save_checkpoint(executor,
492
492
if not os .path .isdir (checkpoint_dir ):
493
493
os .makedirs (checkpoint_dir )
494
494
495
- serial = _get_lastest_checkpoint_dir (checkpoint_dir ) + 1
495
+ serial = _get_latest_checkpoint_dir (checkpoint_dir ) + 1
496
496
cur_dir = _get_serial_dir (checkpoint_dir , serial )
497
497
498
498
save_trainer_args (cur_dir , trainer_id , trainer_args )
@@ -505,11 +505,11 @@ def save_checkpoint(executor,
505
505
506
506
def get_latest_checkpoint_serial (checkpoint_dir ):
507
507
"""
508
- If the directory have checkpoint files, it will return lastest checkpoint directory serial number
508
+ If the directory have checkpoint files, it will return latest checkpoint directory serial number
509
509
510
510
:param checkpoint_dir
511
511
"""
512
- serial = _get_lastest_checkpoint_dir (checkpoint_dir )
512
+ serial = _get_latest_checkpoint_dir (checkpoint_dir )
513
513
if serial < 0 :
514
514
return None
515
515
return serial
@@ -639,14 +639,14 @@ def _is_checkpoint_var(var):
639
639
var .desc .type () == core .VarDesc .VarType .FETCH_LIST or \
640
640
var .desc .type () == core .VarDesc .VarType .RAW :
641
641
return False
642
- # @GRAD are named for gradient varibales , checkpoint will not save it.
642
+ # @GRAD are named for gradient variables , checkpoint will not save it.
643
643
if "@GRAD" in var .name :
644
644
return False
645
- # .trainer_ are named for distribute trian variables, checkpoint will not save it.
645
+ # .trainer_ are named for distribute train variables, checkpoint will not save it.
646
646
if ".trainer_" in var .name :
647
647
return False
648
648
649
- # .block is named for distribute trian variables, checkpoint will not save it.
649
+ # .block is named for distribute train variables, checkpoint will not save it.
650
650
if ".block" in var .name :
651
651
return False
652
652
@@ -656,7 +656,6 @@ def _is_checkpoint_var(var):
656
656
def _get_dir_serial (dirname ):
657
657
_ , serial = dirname .split (CHECKPOINT_SEPARATOR )
658
658
659
- serial_num = - 1
660
659
try :
661
660
serial_num = int (serial )
662
661
except ValueError :
@@ -723,7 +722,7 @@ def _write_success(dirname):
723
722
f .write (now )
724
723
725
724
726
- def _get_lastest_checkpoint_dir (checkpoint_dir ):
725
+ def _get_latest_checkpoint_dir (checkpoint_dir ):
727
726
"""
728
727
get the latest file in checkpoint directory, the _SUCCESS file must exist in the directory
729
728
0 commit comments