Skip to content

Commit 01fda93

Browse files
authored
Merge pull request #13523 from velconia/fix_rnn_search
Fix reader of rnn_search in python3
2 parents 1d91a49 + 06289aa commit 01fda93

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python/paddle/dataset/wmt14.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def reader():
8989
]
9090
for name in names:
9191
for line in f.extractfile(name):
92-
line_split = line.strip().split(six.b('\t'))
92+
line = cpt.to_text(line)
93+
line_split = line.strip().split('\t')
9394
if len(line_split) != 2:
9495
continue
9596
src_seq = line_split[0] # one source sequence

python/paddle/dataset/wmt16.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def __build_dict(tar_file, dict_size, save_path, lang):
6464
word_dict = defaultdict(int)
6565
with tarfile.open(tar_file, mode="r") as f:
6666
for line in f.extractfile("wmt16/train"):
67-
line_split = line.strip().split(six.b("\t"))
67+
line = cpt.to_text(line)
68+
line_split = line.strip().split("\t")
6869
if len(line_split) != 2: continue
6970
sen = line_split[0] if lang == "en" else line_split[1]
7071
for w in sen.split():
@@ -123,7 +124,8 @@ def reader():
123124

124125
with tarfile.open(tar_file, mode="r") as f:
125126
for line in f.extractfile(file_name):
126-
line_split = line.strip().split(six.b("\t"))
127+
line = cpt.to_text(line)
128+
line_split = line.strip().split("\t")
127129
if len(line_split) != 2:
128130
continue
129131
src_words = line_split[src_col].split()

0 commit comments

Comments
 (0)