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 19
19
from __future__ import division
20
20
from __future__ import print_function
21
21
22
+ import codecs
22
23
import functools
23
24
import gzip
24
25
import itertools
@@ -870,8 +871,13 @@ def _get_tuv_seg(tuv):
870
871
assert len (segs ) == 1 , "Invalid number of segments: %d" % len (segs )
871
872
return segs [0 ].text
872
873
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 ):
875
881
if elem .tag == "tu" :
876
882
yield {
877
883
_get_tuv_lang (tuv ):
You can’t perform that action at this time.
0 commit comments