提交 cea791c6 编写于 作者: W wangxiao1021

remove unnecessary import

上级 461b3e28
...@@ -22,14 +22,14 @@ python版本依赖python 2.7或python 3.5及以上版本。 ...@@ -22,14 +22,14 @@ python版本依赖python 2.7或python 3.5及以上版本。
#### 代码下载及环境变量设置 #### 代码下载及环境变量设置
克隆代码库到本地,并设置`PYTHONPATH`环境变量 克隆代码库到本地,并设置`PYTHONPATH`环境变量
```bash ```shell
git clone https://github.com/PaddlePaddle/hapi git clone https://github.com/PaddlePaddle/hapi
cd hapi cd hapi
export PYTHONPATH=$PYTHONPATH:`pwd` export PYTHONPATH=$PYTHONPATH:`pwd`
cd examples/sentiment_classification cd examples/sentiment_classification
``` ```
#### 数据准备 #### 数据准备
...@@ -55,7 +55,7 @@ python sentiment_classifier.py ...@@ -55,7 +55,7 @@ python sentiment_classifier.py
利用已有模型,可以运行下面命令,对未知label的数据(test.tsv)进行预测。 利用已有模型,可以运行下面命令,对未知label的数据(test.tsv)进行预测。
模型预测需确保`senta.yaml``do_infer`属性为`True` 模型预测需确保`senta.yaml``do_infer`属性`True`
```shell ```shell
python sentiment_classifier.py python sentiment_classifier.py
...@@ -92,8 +92,8 @@ python sentiment_classifier.py ...@@ -92,8 +92,8 @@ python sentiment_classifier.py
```text ```text
特 喜欢 这种 好看的 狗狗 1 特 喜欢 这种 好看的 狗狗 1
这 真是 惊艳 世界 的 中国 黑科技 1 这 真是 惊艳 世界 的 中国 黑科技 1
环境 特别 差 ,脏兮兮 的,再也 不去 了 0 环境 特别 差 ,脏兮兮 的,再也 不去 了 0
``` ```
#### 代码结构说明 #### 代码结构说明
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid 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 from paddle.fluid.dygraph.base import to_variable
import numpy as np import numpy as np
from hapi.model import Model from hapi.model import Model
from hapi.text.text import GRUEncoderLayer as BiGRUEncoder 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): class CNN(Model):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册