From 050327e968b2d7d9090ab882a5dd6b0fdeca80b4 Mon Sep 17 00:00:00 2001 From: chenxuyi Date: Mon, 3 Feb 2020 15:51:29 +0800 Subject: [PATCH] remove mrc loops --- README.md | 2 +- README.zh.md | 2 +- ernie/finetune/mrc.py | 2 +- ernie/run_mrc.py | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index dbaefdd..74182bc 100644 --- a/README.md +++ b/README.md @@ -653,7 +653,7 @@ BQ Corpus (Bank Question corpus) is a Chinese corpus for sentence semantic equiv ### Install PaddlePaddle -This code base has been tested with Paddle Fluid 1.6.3 with Python 2/3.5+, since Paddle 1.6.3 has changed some of APIs, using version before 1.6.3 might have bug on NER tasks. +This code base has been tested with Paddle Fluid 1.6 with Python 2/3.5+, since Paddle 1.6 has changed some of APIs, using version before 1.6 might have bug on NER tasks. **\*Important\*** When finished installing Paddle Fluid, remember to update LD_LIBRARY_PATH about CUDA, cuDNN, NCCL2, for more information on paddlepaddle setup, you can click [here](http://en.paddlepaddle.org/documentation/docs/en/1.5/beginners_guide/index_en.html) and [here](http://en.paddlepaddle.org/documentation/docs/en/1.5/beginners_guide/install/install_Ubuntu_en.html). Also, you can read FAQ at the end of this document when you encounter errors. diff --git a/README.zh.md b/README.zh.md index 6008d1a..9fce0f3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -689,7 +689,7 @@ ERNIE Tiny轻量级模型在公开数据集的效果如下所示,任务均值 ## PaddlePaddle安装 -本项目依赖于 Paddle 1.6.3,* 由于Paddle 1.6.3版本相比之前版本有较大API改动,使用Paddle 1.6.3以前版本运行本代码库会导致序列标注等任务报错 *,请参考[安装指南](http://www.paddlepaddle.org/#quick-start)进行安装。 +本项目依赖于 Paddle 1.6,* 由于Paddle 1.6版本相比之前版本有较大API改动,使用Paddle 1.6以前版本运行本代码库会导致序列标注等任务报错 *,请参考[安装指南](http://www.paddlepaddle.org/#quick-start)进行安装。 **【重要】安装后,需要及时的将 CUDA、cuDNN、NCCL2 等动态库路径加入到环境变量 LD_LIBRARY_PATH 之中,否则训练过程中会报相关的库错误。具体的paddlepaddle配置细节请查阅[这里](http://en.paddlepaddle.org/documentation/docs/zh/1.5/beginners_guide/quick_start_cn.html)** diff --git a/ernie/finetune/mrc.py b/ernie/finetune/mrc.py index 3cc13a8..cfe3bbd 100644 --- a/ernie/finetune/mrc.py +++ b/ernie/finetune/mrc.py @@ -44,7 +44,7 @@ def create_model(args, pyreader_name, ernie_config, is_training): pos_ids = fluid.layers.data(name='2', shape=[-1, args.max_seq_len, 1], dtype='int64') sent_ids= fluid.layers.data(name='3', shape=[-1, args.max_seq_len, 1], dtype='int64') task_ids= fluid.layers.data(name='4', shape=[-1, args.max_seq_len, 1], dtype='int64') - input_mask = fluid.layers.data(name='5', shape=[-1, 1], dtype='float32') + input_mask = fluid.layers.data(name='5', shape=[-1, args.max_seq_len, 1], dtype='float32') start_positions = fluid.layers.data(name='6', shape=[-1, 1], dtype='int64') end_positions = fluid.layers.data(name='7', shape=[-1, 1], dtype='int64') unique_id = fluid.layers.data(name='8', shape=[-1, 1], dtype='int64') diff --git a/ernie/run_mrc.py b/ernie/run_mrc.py index b8b4e42..4181e45 100644 --- a/ernie/run_mrc.py +++ b/ernie/run_mrc.py @@ -361,7 +361,6 @@ def main(args): if __name__ == '__main__': prepare_logger(log) print_arguments(args) - while True: - scope = fluid.core.Scope() - with fluid.scope_guard(scope): - main(args) + scope = fluid.core.Scope() + with fluid.scope_guard(scope): + main(args) -- GitLab