From cea791c65a68c5abd4023914ad1f4589b01d81fc Mon Sep 17 00:00:00 2001 From: wangxiao1021 Date: Mon, 27 Apr 2020 17:02:20 +0800 Subject: [PATCH] remove unnecessary import --- examples/sentiment_classification/README.md | 20 ++++++++++---------- examples/sentiment_classification/models.py | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/sentiment_classification/README.md b/examples/sentiment_classification/README.md index adc0948..9de6eb7 100644 --- a/examples/sentiment_classification/README.md +++ b/examples/sentiment_classification/README.md @@ -22,14 +22,14 @@ python版本依赖python 2.7或python 3.5及以上版本。 #### 代码下载及环境变量设置 - 克隆代码库到本地,并设置`PYTHONPATH`环境变量 +克隆代码库到本地,并设置`PYTHONPATH`环境变量 - ```bash - git clone https://github.com/PaddlePaddle/hapi - cd hapi - export PYTHONPATH=$PYTHONPATH:`pwd` - cd examples/sentiment_classification - ``` +```shell +git clone https://github.com/PaddlePaddle/hapi +cd hapi +export PYTHONPATH=$PYTHONPATH:`pwd` +cd examples/sentiment_classification +``` #### 数据准备 @@ -55,7 +55,7 @@ python sentiment_classifier.py 利用已有模型,可以运行下面命令,对未知label的数据(test.tsv)进行预测。 -模型预测需确保`senta.yaml`中`do_infer`属性为`True`。 +模型预测需确保`senta.yaml`中`do_infer`属性置为`True`。 ```shell python sentiment_classifier.py @@ -92,8 +92,8 @@ python sentiment_classifier.py ```text 特 喜欢 这种 好看的 狗狗 1 -这 真是 惊艳 世界 的 中国 黑科技 1 -环境 特别 差 ,脏兮兮 的,再也 不去 了 0 +这 真是 惊艳 世界 的 中国 黑科技 1 +环境 特别 差 ,脏兮兮 的,再也 不去 了 0 ``` #### 代码结构说明 diff --git a/examples/sentiment_classification/models.py b/examples/sentiment_classification/models.py index 744e15f..313b928 100644 --- a/examples/sentiment_classification/models.py +++ b/examples/sentiment_classification/models.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import paddle.fluid as fluid -from paddle.fluid.dygraph.nn import Conv2D, Pool2D, Linear, Embedding +from paddle.fluid.dygraph.nn import Linear, Embedding from paddle.fluid.dygraph.base import to_variable import numpy as np from hapi.model import Model from hapi.text.text import GRUEncoderLayer as BiGRUEncoder -from hapi.text.text import BOWEncoder, CNNEncoder, GRUEncoder +from hapi.text.test import BOWEncoder, CNNEncoder, GRUEncoder class CNN(Model): -- GitLab