diff --git a/examples/sentiment_classification/README.md b/examples/sentiment_classification/README.md index adc0948b357c81e46ef6dde10b3005545a74db34..9de6eb7ecfb4cb557b8296309710c2c7c5240b77 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 744e15f8c54e6fd9d4cf13a4855c1ae9f4c981ff..313b928778f64001c5b37888bc546d6ff33bd970 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):