Skip to content

Commit 09307ec

Browse files
committed
Remove fluid api in modules and pkg.
1 parent 0710a5a commit 09307ec

File tree

1 file changed

+8
-9
lines changed
  • modules/text/language_model/ernie_v2_eng_base

1 file changed

+8
-9
lines changed

modules/text/language_model/ernie_v2_eng_base/module.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
3131

3232
@moduleinfo(
3333
name="ernie_v2_eng_base",
34-
version="2.0.2",
34+
version="2.0.3",
3535
summary=
3636
"Baidu's ERNIE 2.0, Enhanced Representation through kNowledge IntEgration, max_seq_len=512 when predtrained. The module is executed as paddle.dygraph.",
3737
author="paddlepaddle",
@@ -65,26 +65,25 @@ def __init__(
6565
"current task name 'sequence_classification' was renamed to 'seq-cls', "
6666
"'sequence_classification' has been deprecated and will be removed in the future.", )
6767
if task == 'seq-cls':
68-
self.model = ErnieForSequenceClassification.from_pretrained(pretrained_model_name_or_path='ernie-2.0-en',
69-
num_classes=self.num_classes,
70-
**kwargs)
68+
self.model = ErnieForSequenceClassification.from_pretrained(
69+
pretrained_model_name_or_path='ernie-2.0-base-en', num_classes=self.num_classes, **kwargs)
7170
self.criterion = paddle.nn.loss.CrossEntropyLoss()
7271
self.metric = paddle.metric.Accuracy()
7372
elif task == 'token-cls':
74-
self.model = ErnieForTokenClassification.from_pretrained(pretrained_model_name_or_path='ernie-2.0-en',
73+
self.model = ErnieForTokenClassification.from_pretrained(pretrained_model_name_or_path='ernie-2.0-base-en',
7574
num_classes=self.num_classes,
7675
**kwargs)
7776
self.criterion = paddle.nn.loss.CrossEntropyLoss()
7877
self.metric = ChunkEvaluator(label_list=[self.label_map[i] for i in sorted(self.label_map.keys())],
7978
suffix=suffix)
8079
elif task == 'text-matching':
81-
self.model = ErnieModel.from_pretrained(pretrained_model_name_or_path='ernie-2.0-en', **kwargs)
80+
self.model = ErnieModel.from_pretrained(pretrained_model_name_or_path='ernie-2.0-base-en', **kwargs)
8281
self.dropout = paddle.nn.Dropout(0.1)
8382
self.classifier = paddle.nn.Linear(self.model.config['hidden_size'] * 3, 2)
8483
self.criterion = paddle.nn.loss.CrossEntropyLoss()
8584
self.metric = paddle.metric.Accuracy()
8685
elif task is None:
87-
self.model = ErnieModel.from_pretrained(pretrained_model_name_or_path='ernie-2.0-en', **kwargs)
86+
self.model = ErnieModel.from_pretrained(pretrained_model_name_or_path='ernie-2.0-base-en', **kwargs)
8887
else:
8988
raise RuntimeError("Unknown task {}, task should be one in {}".format(task, self._tasks_supported))
9089

@@ -176,4 +175,4 @@ def get_tokenizer(*args, **kwargs):
176175
"""
177176
Gets the tokenizer that is customized for this module.
178177
"""
179-
return ErnieTokenizer.from_pretrained(pretrained_model_name_or_path='ernie-2.0-en', *args, **kwargs)
178+
return ErnieTokenizer.from_pretrained(pretrained_model_name_or_path='ernie-2.0-base-en', *args, **kwargs)

0 commit comments

Comments
 (0)