Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
96592b54
Unverified
Commit
96592b54
authored
May 30, 2019
by
Victor SANH
Committed by
GitHub
May 30, 2019
Browse files
default in __init__s for classification BERT models (#650)
parent
4cda86b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
pytorch_pretrained_bert/modeling.py
pytorch_pretrained_bert/modeling.py
+3
-3
No files found.
pytorch_pretrained_bert/modeling.py
View file @
96592b54
...
@@ -980,7 +980,7 @@ class BertForSequenceClassification(BertPreTrainedModel):
...
@@ -980,7 +980,7 @@ class BertForSequenceClassification(BertPreTrainedModel):
logits = model(input_ids, token_type_ids, input_mask)
logits = model(input_ids, token_type_ids, input_mask)
```
```
"""
"""
def
__init__
(
self
,
config
,
num_labels
):
def
__init__
(
self
,
config
,
num_labels
=
2
):
super
(
BertForSequenceClassification
,
self
).
__init__
(
config
)
super
(
BertForSequenceClassification
,
self
).
__init__
(
config
)
self
.
num_labels
=
num_labels
self
.
num_labels
=
num_labels
self
.
bert
=
BertModel
(
config
)
self
.
bert
=
BertModel
(
config
)
...
@@ -1045,7 +1045,7 @@ class BertForMultipleChoice(BertPreTrainedModel):
...
@@ -1045,7 +1045,7 @@ class BertForMultipleChoice(BertPreTrainedModel):
logits = model(input_ids, token_type_ids, input_mask)
logits = model(input_ids, token_type_ids, input_mask)
```
```
"""
"""
def
__init__
(
self
,
config
,
num_choices
):
def
__init__
(
self
,
config
,
num_choices
=
2
):
super
(
BertForMultipleChoice
,
self
).
__init__
(
config
)
super
(
BertForMultipleChoice
,
self
).
__init__
(
config
)
self
.
num_choices
=
num_choices
self
.
num_choices
=
num_choices
self
.
bert
=
BertModel
(
config
)
self
.
bert
=
BertModel
(
config
)
...
@@ -1115,7 +1115,7 @@ class BertForTokenClassification(BertPreTrainedModel):
...
@@ -1115,7 +1115,7 @@ class BertForTokenClassification(BertPreTrainedModel):
logits = model(input_ids, token_type_ids, input_mask)
logits = model(input_ids, token_type_ids, input_mask)
```
```
"""
"""
def
__init__
(
self
,
config
,
num_labels
):
def
__init__
(
self
,
config
,
num_labels
=
2
):
super
(
BertForTokenClassification
,
self
).
__init__
(
config
)
super
(
BertForTokenClassification
,
self
).
__init__
(
config
)
self
.
num_labels
=
num_labels
self
.
num_labels
=
num_labels
self
.
bert
=
BertModel
(
config
)
self
.
bert
=
BertModel
(
config
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment