Skip to content

Commit bfdcf18

Browse files
committed
grammar optimized.
1 parent 08e5f0a commit bfdcf18

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

python/paddle/fluid/io.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def save_checkpoint(executor,
492492
if not os.path.isdir(checkpoint_dir):
493493
os.makedirs(checkpoint_dir)
494494

495-
serial = _get_lastest_checkpoint_dir(checkpoint_dir) + 1
495+
serial = _get_latest_checkpoint_dir(checkpoint_dir) + 1
496496
cur_dir = _get_serial_dir(checkpoint_dir, serial)
497497

498498
save_trainer_args(cur_dir, trainer_id, trainer_args)
@@ -505,11 +505,11 @@ def save_checkpoint(executor,
505505

506506
def get_latest_checkpoint_serial(checkpoint_dir):
507507
"""
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
509509
510510
:param checkpoint_dir
511511
"""
512-
serial = _get_lastest_checkpoint_dir(checkpoint_dir)
512+
serial = _get_latest_checkpoint_dir(checkpoint_dir)
513513
if serial < 0:
514514
return None
515515
return serial
@@ -639,14 +639,14 @@ def _is_checkpoint_var(var):
639639
var.desc.type() == core.VarDesc.VarType.FETCH_LIST or \
640640
var.desc.type() == core.VarDesc.VarType.RAW:
641641
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.
643643
if "@GRAD" in var.name:
644644
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.
646646
if ".trainer_" in var.name:
647647
return False
648648

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.
650650
if ".block" in var.name:
651651
return False
652652

@@ -656,7 +656,6 @@ def _is_checkpoint_var(var):
656656
def _get_dir_serial(dirname):
657657
_, serial = dirname.split(CHECKPOINT_SEPARATOR)
658658

659-
serial_num = -1
660659
try:
661660
serial_num = int(serial)
662661
except ValueError:
@@ -723,7 +722,7 @@ def _write_success(dirname):
723722
f.write(now)
724723

725724

726-
def _get_lastest_checkpoint_dir(checkpoint_dir):
725+
def _get_latest_checkpoint_dir(checkpoint_dir):
727726
"""
728727
get the latest file in checkpoint directory, the _SUCCESS file must exist in the directory
729728

0 commit comments

Comments
 (0)