提交 a9183ac3 编写于 作者: D dengkaipeng

fix valid-interval in train.py

上级 cc9d0baa
data
dataset
checkpoints
output*
*.pyc
......
......@@ -80,7 +80,7 @@ def train_without_pyreader(exe, train_prog, train_exe, train_reader, train_feede
format(epoch, np.mean(epoch_periods)))
save_model(exe, train_prog, save_dir, save_model_name,
"_epoch{}".format(epoch))
if test_exe and (epoch + 1) % valid_interval == 0:
if test_exe and valid_interval > 0 and (epoch + 1) % valid_interval == 0:
test_without_pyreader(test_exe, test_reader, test_feeder,
test_fetch_list, test_metrics, log_interval)
......@@ -119,7 +119,7 @@ def train_with_pyreader(exe, train_prog, train_exe, train_pyreader, \
format(epoch, np.mean(epoch_periods)))
save_model(exe, train_prog, save_dir, save_model_name,
"_epoch{}".format(epoch))
if test_exe and valid_interval > 0:
if test_exe and valid_interval > 0 and (epoch + 1) % valid_interval == 0:
test_with_pyreader(test_exe, test_pyreader, test_fetch_list,
test_metrics, log_interval)
finally:
......
......@@ -81,11 +81,6 @@ def parse_args():
type=int,
default=1,
help='validation epoch interval, 0 for no validation.')
parser.add_argument(
'--save-interval',
type=int,
default=1,
help='save checkpoints epoch interval.')
parser.add_argument(
'--save-dir',
type=str,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册