Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
7c2a32ff
Commit
7c2a32ff
authored
Apr 23, 2020
by
Julien Chaumond
Browse files
[housekeeping] super()
parent
a946b6b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
src/transformers/modeling_bert.py
src/transformers/modeling_bert.py
+1
-1
src/transformers/modeling_flaubert.py
src/transformers/modeling_flaubert.py
+5
-5
src/transformers/modeling_tf_flaubert.py
src/transformers/modeling_tf_flaubert.py
+4
-4
No files found.
src/transformers/modeling_bert.py
View file @
7c2a32ff
...
@@ -1347,7 +1347,7 @@ class BertForTokenClassification(BertPreTrainedModel):
...
@@ -1347,7 +1347,7 @@ class BertForTokenClassification(BertPreTrainedModel):
)
)
class
BertForQuestionAnswering
(
BertPreTrainedModel
):
class
BertForQuestionAnswering
(
BertPreTrainedModel
):
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
BertForQuestionAnswering
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
num_labels
=
config
.
num_labels
self
.
num_labels
=
config
.
num_labels
self
.
bert
=
BertModel
(
config
)
self
.
bert
=
BertModel
(
config
)
...
...
src/transformers/modeling_flaubert.py
View file @
7c2a32ff
...
@@ -112,7 +112,7 @@ class FlaubertModel(XLMModel):
...
@@ -112,7 +112,7 @@ class FlaubertModel(XLMModel):
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
):
# , dico, is_encoder, with_output):
def
__init__
(
self
,
config
):
# , dico, is_encoder, with_output):
super
(
FlaubertModel
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
layerdrop
=
getattr
(
config
,
"layerdrop"
,
0.0
)
self
.
layerdrop
=
getattr
(
config
,
"layerdrop"
,
0.0
)
self
.
pre_norm
=
getattr
(
config
,
"pre_norm"
,
False
)
self
.
pre_norm
=
getattr
(
config
,
"pre_norm"
,
False
)
...
@@ -307,7 +307,7 @@ class FlaubertWithLMHeadModel(XLMWithLMHeadModel):
...
@@ -307,7 +307,7 @@ class FlaubertWithLMHeadModel(XLMWithLMHeadModel):
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
FlaubertWithLMHeadModel
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
init_weights
()
self
.
init_weights
()
...
@@ -327,7 +327,7 @@ class FlaubertForSequenceClassification(XLMForSequenceClassification):
...
@@ -327,7 +327,7 @@ class FlaubertForSequenceClassification(XLMForSequenceClassification):
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
FlaubertForSequenceClassification
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
init_weights
()
self
.
init_weights
()
...
@@ -347,7 +347,7 @@ class FlaubertForQuestionAnsweringSimple(XLMForQuestionAnsweringSimple):
...
@@ -347,7 +347,7 @@ class FlaubertForQuestionAnsweringSimple(XLMForQuestionAnsweringSimple):
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
FlaubertForQuestionAnsweringSimple
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
init_weights
()
self
.
init_weights
()
...
@@ -367,6 +367,6 @@ class FlaubertForQuestionAnswering(XLMForQuestionAnswering):
...
@@ -367,6 +367,6 @@ class FlaubertForQuestionAnswering(XLMForQuestionAnswering):
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
super
(
FlaubertForQuestionAnswering
,
self
).
__init__
(
config
)
super
().
__init__
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
transformer
=
FlaubertModel
(
config
)
self
.
init_weights
()
self
.
init_weights
()
src/transformers/modeling_tf_flaubert.py
View file @
7c2a32ff
...
@@ -107,13 +107,13 @@ class TFFlaubertModel(TFXLMModel):
...
@@ -107,13 +107,13 @@ class TFFlaubertModel(TFXLMModel):
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
super
(
TFFlaubertModel
,
self
).
__init__
(
config
,
*
inputs
,
**
kwargs
)
super
().
__init__
(
config
,
*
inputs
,
**
kwargs
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
class
TFFlaubertMainLayer
(
TFXLMMainLayer
):
class
TFFlaubertMainLayer
(
TFXLMMainLayer
):
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
super
(
TFFlaubertMainLayer
,
self
).
__init__
(
config
,
*
inputs
,
**
kwargs
)
super
().
__init__
(
config
,
*
inputs
,
**
kwargs
)
self
.
layerdrop
=
getattr
(
config
,
"layerdrop"
,
0.0
)
self
.
layerdrop
=
getattr
(
config
,
"layerdrop"
,
0.0
)
self
.
pre_norm
=
getattr
(
config
,
"pre_norm"
,
False
)
self
.
pre_norm
=
getattr
(
config
,
"pre_norm"
,
False
)
...
@@ -312,7 +312,7 @@ class TFFlaubertWithLMHeadModel(TFXLMWithLMHeadModel):
...
@@ -312,7 +312,7 @@ class TFFlaubertWithLMHeadModel(TFXLMWithLMHeadModel):
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
super
(
TFFlaubertWithLMHeadModel
,
self
).
__init__
(
config
,
*
inputs
,
**
kwargs
)
super
().
__init__
(
config
,
*
inputs
,
**
kwargs
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
...
@@ -326,5 +326,5 @@ class TFFlaubertForSequenceClassification(TFXLMForSequenceClassification):
...
@@ -326,5 +326,5 @@ class TFFlaubertForSequenceClassification(TFXLMForSequenceClassification):
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
pretrained_model_archive_map
=
TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_MAP
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
super
(
TFFlaubertForSequenceClassification
,
self
).
__init__
(
config
,
*
inputs
,
**
kwargs
)
super
().
__init__
(
config
,
*
inputs
,
**
kwargs
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
self
.
transformer
=
TFFlaubertMainLayer
(
config
,
name
=
"transformer"
)
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