Skip to content

Commit 5b89324

Browse files
gtbairuotianluo
authored andcommitted
Bug fix for exception when tf is not None while language_eval is 0. (ruotianluo#89)
1 parent a1445e4 commit 5b89324

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

train.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ def train(opt):
150150
# Write validation result into summary
151151
if tf is not None:
152152
add_summary_value(tf_summary_writer, 'validation loss', val_loss, iteration)
153-
for k,v in lang_stats.items():
154-
add_summary_value(tf_summary_writer, k, v, iteration)
153+
if opt.language_eval == 1:
154+
for k,v in lang_stats.items():
155+
add_summary_value(tf_summary_writer, k, v, iteration)
155156
tf_summary_writer.flush()
156157
val_result_history[iteration] = {'loss': val_loss, 'lang_stats': lang_stats, 'predictions': predictions}
157158

0 commit comments

Comments
 (0)