Commit b75faf5a authored by Neal Wu's avatar Neal Wu
Browse files

Fix rnn translate in python3

parent 07827aab
...@@ -2,8 +2,8 @@ This directory contains functions for creating recurrent neural networks ...@@ -2,8 +2,8 @@ This directory contains functions for creating recurrent neural networks
and sequence-to-sequence models. Detailed instructions on how to get started and sequence-to-sequence models. Detailed instructions on how to get started
and use them are available in the tutorials. and use them are available in the tutorials.
* [RNN Tutorial](http://tensorflow.org/tutorials/recurrent/index.md) * [RNN Tutorial](http://tensorflow.org/tutorials/recurrent/)
* [Sequence-to-Sequence Tutorial](http://tensorflow.org/tutorials/seq2seq/index.md) * [Sequence-to-Sequence Tutorial](http://tensorflow.org/tutorials/seq2seq/)
Here is a short overview of what is in this directory. Here is a short overview of what is in this directory.
......
...@@ -177,7 +177,7 @@ def initialize_vocabulary(vocabulary_path): ...@@ -177,7 +177,7 @@ def initialize_vocabulary(vocabulary_path):
rev_vocab = [] rev_vocab = []
with gfile.GFile(vocabulary_path, mode="rb") as f: with gfile.GFile(vocabulary_path, mode="rb") as f:
rev_vocab.extend(f.readlines()) rev_vocab.extend(f.readlines())
rev_vocab = [line.strip() for line in rev_vocab] rev_vocab = [tf.compat.as_bytes(line.strip()) for line in rev_vocab]
vocab = dict([(x, y) for (y, x) in enumerate(rev_vocab)]) vocab = dict([(x, y) for (y, x) in enumerate(rev_vocab)])
return vocab, rev_vocab return vocab, rev_vocab
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment