diff --git a/demo/text_classification/text_cls.py b/demo/text_classification/text_cls.py index a7f4376d44e53637201b270e4fa03f8a750c02e3..9c7d342920456406e67108c15d416c629bda9864 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 a5b8a1261d6e5b63cd31108e049a3d2253d04788..1b4cbe9bec859334e61ee2c67bc82011c9fe9158 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.