Skip to content

Commit 275e22c

Browse files
clu8ruotianluo
authored andcommitted
fix bug when lang_stats not set to 1
1 parent fd445dc commit 275e22c

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
@@ -171,8 +171,9 @@ def train(opt):
171171
# Write validation result into summary
172172
if tf is not None:
173173
add_summary_value(tf_summary_writer, 'validation loss', val_loss, iteration)
174-
for k,v in lang_stats.items():
175-
add_summary_value(tf_summary_writer, k, v, iteration)
174+
if lang_stats is not None:
175+
for k,v in lang_stats.items():
176+
add_summary_value(tf_summary_writer, k, v, iteration)
176177
tf_summary_writer.flush()
177178
val_result_history[iteration] = {'loss': val_loss, 'lang_stats': lang_stats, 'predictions': predictions}
178179

0 commit comments

Comments
 (0)