💄 super

This commit is contained in:
Julien Chaumond
2020-01-15 18:33:50 -05:00
parent cd51893d37
commit 83a41d39b3
75 changed files with 328 additions and 328 deletions

View File

@@ -80,7 +80,7 @@ class XxxConfig(PretrainedConfig):
summary_first_dropout=0.1,
**kwargs
):
super(XxxConfig, self).__init__(**kwargs)
super().__init__(**kwargs)
self.vocab_size = vocab_size
self.n_ctx = n_ctx
self.n_positions = n_positions

View File

@@ -69,7 +69,7 @@ TFXxxOutput = tf.keras.layers.Layer
class TFXxxLayer(tf.keras.layers.Layer):
def __init__(self, config, **kwargs):
super(TFXxxLayer, self).__init__(**kwargs)
super().__init__(**kwargs)
self.attention = TFXxxAttention(config, name="attention")
self.intermediate = TFXxxIntermediate(config, name="intermediate")
self.transformer_output = TFXxxOutput(config, name="output")
@@ -91,7 +91,7 @@ class TFXxxLayer(tf.keras.layers.Layer):
####################################################
class TFXxxMainLayer(tf.keras.layers.Layer):
def __init__(self, config, **kwargs):
super(TFXxxMainLayer, self).__init__(**kwargs)
super().__init__(**kwargs)
def _resize_token_embeddings(self, new_num_tokens):
raise NotImplementedError # Not implemented yet in the library fr TF 2.0 models
@@ -307,7 +307,7 @@ class TFXxxModel(TFXxxPreTrainedModel):
"""
def __init__(self, config, *inputs, **kwargs):
super(TFXxxModel, self).__init__(config, *inputs, **kwargs)
super().__init__(config, *inputs, **kwargs)
self.transformer = TFXxxMainLayer(config, name="transformer")
def call(self, inputs, **kwargs):
@@ -348,7 +348,7 @@ class TFXxxForMaskedLM(TFXxxPreTrainedModel):
"""
def __init__(self, config, *inputs, **kwargs):
super(TFXxxForMaskedLM, self).__init__(config, *inputs, **kwargs)
super().__init__(config, *inputs, **kwargs)
self.transformer = TFXxxMainLayer(config, name="transformer")
self.mlm = TFXxxMLMHead(config, self.transformer.embeddings, name="mlm")
@@ -397,7 +397,7 @@ class TFXxxForSequenceClassification(TFXxxPreTrainedModel):
"""
def __init__(self, config, *inputs, **kwargs):
super(TFXxxForSequenceClassification, self).__init__(config, *inputs, **kwargs)
super().__init__(config, *inputs, **kwargs)
self.num_labels = config.num_labels
self.transformer = TFXxxMainLayer(config, name="transformer")
@@ -452,7 +452,7 @@ class TFXxxForTokenClassification(TFXxxPreTrainedModel):
"""
def __init__(self, config, *inputs, **kwargs):
super(TFXxxForTokenClassification, self).__init__(config, *inputs, **kwargs)
super().__init__(config, *inputs, **kwargs)
self.num_labels = config.num_labels
self.transformer = TFXxxMainLayer(config, name="transformer")
@@ -509,7 +509,7 @@ class TFXxxForQuestionAnswering(TFXxxPreTrainedModel):
"""
def __init__(self, config, *inputs, **kwargs):
super(TFXxxForQuestionAnswering, self).__init__(config, *inputs, **kwargs)
super().__init__(config, *inputs, **kwargs)
self.num_labels = config.num_labels
self.transformer = TFXxxMainLayer(config, name="transformer")

View File

@@ -138,7 +138,7 @@ XxxOutput = nn.Module
class XxxLayer(nn.Module):
def __init__(self, config):
super(XxxLayer, self).__init__()
super().__init__()
self.attention = XxxAttention(config)
self.intermediate = XxxIntermediate(config)
self.output = XxxOutput(config)
@@ -298,7 +298,7 @@ class XxxModel(XxxPreTrainedModel):
"""
def __init__(self, config):
super(XxxModel, self).__init__(config)
super().__init__(config)
self.embeddings = XxxEmbeddings(config)
self.encoder = XxxEncoder(config)
@@ -426,7 +426,7 @@ class XxxForMaskedLM(XxxPreTrainedModel):
"""
def __init__(self, config):
super(XxxForMaskedLM, self).__init__(config)
super().__init__(config)
self.transformer = XxxModel(config)
self.lm_head = nn.Linear(config.n_embd, config.vocab_size)
@@ -507,7 +507,7 @@ class XxxForSequenceClassification(XxxPreTrainedModel):
"""
def __init__(self, config):
super(XxxForSequenceClassification, self).__init__(config)
super().__init__(config)
self.num_labels = config.num_labels
self.transformer = XxxModel(config)
@@ -593,7 +593,7 @@ class XxxForTokenClassification(XxxPreTrainedModel):
"""
def __init__(self, config):
super(XxxForTokenClassification, self).__init__(config)
super().__init__(config)
self.num_labels = config.num_labels
self.transformer = XxxModel(config)
@@ -692,7 +692,7 @@ class XxxForQuestionAnswering(XxxPreTrainedModel):
"""
def __init__(self, config):
super(XxxForQuestionAnswering, self).__init__(config)
super().__init__(config)
self.num_labels = config.num_labels
self.transformer = XxxModel(config)

View File

@@ -27,7 +27,7 @@ class XxxTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
tokenizer_class = XxxTokenizer
def setUp(self):
super(XxxTokenizationTest, self).setUp()
super().setUp()
vocab_tokens = [
"[UNK]",

View File

@@ -109,7 +109,7 @@ class XxxTokenizer(PreTrainedTokenizer):
Whether to lower case the input
Only has an effect when do_basic_tokenize=True
"""
super(XxxTokenizer, self).__init__(
super().__init__(
unk_token=unk_token,
sep_token=sep_token,
pad_token=pad_token,