Skip to content

Commit 28a61b2

Browse files
authored
fix text classification deploy mode (PaddlePaddle#1006)
* fix path issue on deploy mode * fix path issue on deploy mode
1 parent c5fb88c commit 28a61b2

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

examples/text_classification/multi_label/deploy/python/predict.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
# limitations under the License.
1414

1515
import argparse
16+
import sys
1617

1718
import paddle
1819
import paddle.nn.functional as F
1920
from paddlenlp.data import Tuple, Pad
2021
from paddlenlp.transformers import BertTokenizer
2122

23+
sys.path.append('./')
24+
2225
from data import convert_example
2326

2427
# yapf: disable

examples/text_classification/pretrained_models/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pretrained_models/
6969
我们以中文情感分类公开数据集ChnSentiCorp为示例数据集,可以运行下面的命令,在训练集(train.tsv)上进行模型训练,并在开发集(dev.tsv)验证
7070
```shell
7171
$ unset CUDA_VISIBLE_DEVICES
72-
$ export PYTHONPATH=$PYTHONPATH:`pwd`
7372
$ python -m paddle.distributed.launch --gpus "0" train.py --device gpu --save_dir ./checkpoints
7473
```
7574

examples/text_classification/pretrained_models/deploy/python/predict.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import argparse
1616
import os
17+
import sys
1718

1819
import numpy as np
1920
import paddle
@@ -24,6 +25,8 @@
2425
from paddlenlp.datasets import load_dataset
2526
from paddlenlp.utils.log import logger
2627

28+
sys.path.append('./')
29+
2730
from utils import convert_example
2831

2932
# yapf: disable

examples/text_classification/pretrained_models/deploy/serving/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414

1515
import argparse
1616
import numpy as np
17+
import sys
1718

1819
import paddle
1920
from paddlenlp.data import Tuple, Pad
2021
from paddlenlp.transformers import ErnieTinyTokenizer
2122
from paddle_serving_client import Client
2223
from scipy.special import softmax
2324

25+
sys.path.append('./')
26+
2427
from utils import convert_example
2528

2629
# yapf: disable

0 commit comments

Comments
 (0)