Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit fa9ad63

Browse files
author
Ryan Sepassi
committed
Py3 fixes
PiperOrigin-RevId: 172172540
1 parent d58af0c commit fa9ad63

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tensor2tensor/data_generators/cnn_dailymail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def story_generator(tmp_dir):
7474
for path in paths:
7575
for story_file in tf.gfile.Glob(path + "*"):
7676
story = u""
77-
for line in tf.gfile.Open(story_file):
77+
for line in tf.gfile.Open(story_file, "rb"):
7878
line = unicode(line, "utf-8") if six.PY2 else line.decode("utf-8")
7979
story += line
8080
yield story

tensor2tensor/utils/beam_search_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def symbols_to_logits(ids, states):
318318
# Catch and fail so that the testing framework doesn't think it's an error
319319
try:
320320
sess.run(final_ids)
321-
except tf.errors.InvalidArgumentError, e:
321+
except tf.errors.InvalidArgumentError as e:
322322
raise AssertionError(e.message)
323323

324324
def testStateBeamTwo(self):
@@ -366,7 +366,7 @@ def symbols_to_logits(ids, states):
366366
# Catch and fail so that the testing framework doesn't think it's an error
367367
try:
368368
sess.run(final_ids)
369-
except tf.errors.InvalidArgumentError, e:
369+
except tf.errors.InvalidArgumentError as e:
370370
raise AssertionError(e.message)
371371

372372
if __name__ == "__main__":

0 commit comments

Comments
 (0)