From 84b90669a95eeae74d4cae7cbe3f398a99a88297 Mon Sep 17 00:00:00 2001 From: lujun Date: Sat, 29 Dec 2018 16:20:11 +0800 Subject: [PATCH] fix bug for machine_reading_comprehension in python3x, test=develop --- fluid/PaddleNLP/machine_reading_comprehension/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fluid/PaddleNLP/machine_reading_comprehension/dataset.py b/fluid/PaddleNLP/machine_reading_comprehension/dataset.py index 9ed3b483..c732ce04 100644 --- a/fluid/PaddleNLP/machine_reading_comprehension/dataset.py +++ b/fluid/PaddleNLP/machine_reading_comprehension/dataset.py @@ -23,6 +23,7 @@ import json import logging import numpy as np from collections import Counter +import io class BRCDataset(object): @@ -67,7 +68,7 @@ class BRCDataset(object): Args: data_path: the data file to load """ - with open(data_path, 'r', encoding='utf-8') as fin: + with io.open(data_path, 'r', encoding='utf-8') as fin: data_set = [] for lidx, line in enumerate(fin): sample = json.loads(line.strip()) -- GitLab