File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
tensorflow_datasets/translate Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1919from __future__ import division
2020from __future__ import print_function
2121
22+ import codecs
2223import functools
2324import gzip
2425import itertools
@@ -870,8 +871,13 @@ def _get_tuv_seg(tuv):
870871 assert len (segs ) == 1 , "Invalid number of segments: %d" % len (segs )
871872 return segs [0 ].text
872873
873- with tf .io .gfile .GFile (path ) as f :
874- for _ , elem in ElementTree .iterparse (f ):
874+ with tf .io .gfile .GFile (path , "rb" ) as f :
875+ if six .PY3 :
876+ # Workaround due to: https://github.com/tensorflow/tensorflow/issues/33563
877+ utf_f = codecs .getreader ("utf-8" )(f )
878+ else :
879+ utf_f = f
880+ for _ , elem in ElementTree .iterparse (utf_f ):
875881 if elem .tag == "tu" :
876882 yield {
877883 _get_tuv_lang (tuv ):
You can’t perform that action at this time.
0 commit comments