From 42c832da049b8ce75bd59433b6ef496025bdd0e1 Mon Sep 17 00:00:00 2001 From: Steffy-zxf Date: Fri, 28 Aug 2020 16:53:23 +0800 Subject: [PATCH] fix typo --- demo/text_classification/text_cls.py | 4 ++-- paddlehub/model/modeling_ernie.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/text_classification/text_cls.py b/demo/text_classification/text_cls.py index a7f4376d..9c7d3429 100644 --- a/demo/text_classification/text_cls.py +++ b/demo/text_classification/text_cls.py @@ -13,7 +13,7 @@ # limitations under the License. from paddlehub.datasets.chnsenticorp import ChnSentiCorp from paddlehub.finetune.trainer import Trainer -from paddlehub.model.modeling_ernie import ErnieforSequenceClassification +from paddlehub.model.modeling_ernie import ErnieForSequenceClassification import paddle.fluid as fluid import paddlehub as hub @@ -29,7 +29,7 @@ if __name__ == '__main__': dev_dataset = ChnSentiCorp( tokenizer=ernie.get_tokenizer(tokenize_chinese_chars=True), max_seq_len=128, mode='dev') - model = ErnieforSequenceClassification(ernie_module=ernie, num_classes=len(train_dataset.get_labels())) + model = ErnieForSequenceClassification(ernie_module=ernie, num_classes=len(train_dataset.get_labels())) optimizer = fluid.optimizer.AdamOptimizer(learning_rate=5e-5, parameter_list=model.parameters()) trainer = Trainer(model, optimizer, checkpoint_dir='test_ernie_text_cls') diff --git a/paddlehub/model/modeling_ernie.py b/paddlehub/model/modeling_ernie.py index a5b8a126..1b4cbe9b 100644 --- a/paddlehub/model/modeling_ernie.py +++ b/paddlehub/model/modeling_ernie.py @@ -22,7 +22,7 @@ from paddlehub.module.module import moduleinfo, Module from paddlehub.tokenizer.bert_tokenizer import BertTokenizer -class ErnieforSequenceClassification(dygraph.Layer): +class ErnieForSequenceClassification(dygraph.Layer): """ This model is customized for that enrie module does the sequence classification, such as the text sentiment classification. This model exploits the ernie + full-connect layers (softmax as activation) to classify the texts. -- GitLab