Skip to content

Commit 425f49e

Browse files
ofilipgunan
authored andcommitted
Fix types in create_vocabulary (translate model) (tensorflow#4793)
1 parent 40d28e2 commit 425f49e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tensorflow/models/rnn/translate/data_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from six.moves import urllib
2727

2828
from tensorflow.python.platform import gfile
29+
import tensorflow as tf
2930

3031
# Special vocabulary symbols - we always put them at the start.
3132
_PAD = b"_PAD"
@@ -137,6 +138,7 @@ def create_vocabulary(vocabulary_path, data_path, max_vocabulary_size,
137138
counter += 1
138139
if counter % 100000 == 0:
139140
print(" processing line %d" % counter)
141+
line = tf.compat.as_bytes(line)
140142
tokens = tokenizer(line) if tokenizer else basic_tokenizer(line)
141143
for w in tokens:
142144
word = _DIGIT_RE.sub(b"0", w) if normalize_digits else w

0 commit comments

Comments
 (0)