Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default value of num_classes for ErnieDoc #1867

Merged
merged 5 commits into from
Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions paddlenlp/transformers/ernie_doc/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ class ErnieDocForSequenceClassification(ErnieDocPretrainedModel):
The dropout ratio of last output. Default to `0.1`.
"""

def __init__(self, ernie_doc, num_classes, dropout=0.1):
def __init__(self, ernie_doc, num_classes=2, dropout=0.1):
super(ErnieDocForSequenceClassification, self).__init__()
self.ernie_doc = ernie_doc
self.linear = nn.Linear(self.ernie_doc.config["hidden_size"],
Expand Down Expand Up @@ -782,7 +782,7 @@ class ErnieDocForTokenClassification(ErnieDocPretrainedModel):
The dropout ratio of last output. Default to 0.1.
"""

def __init__(self, ernie_doc, num_classes, dropout=0.1):
def __init__(self, ernie_doc, num_classes=2, dropout=0.1):
super(ErnieDocForTokenClassification, self).__init__()
self.num_classes = num_classes
self.ernie_doc = ernie_doc # allow ernie_doc to be config
Expand Down