Update modeling_gptbert.py
Browse files- modeling_gptbert.py +5 -0
modeling_gptbert.py
CHANGED
|
@@ -718,6 +718,7 @@ class GptBertForMaskedLM(GptBertModel):
|
|
| 718 |
_tied_weights_keys = ["classifier.emb2vocab.weight"]
|
| 719 |
|
| 720 |
def __init__(self, config: GptBertConfig, **kwargs):
|
|
|
|
| 721 |
super().__init__(config, add_mlm_layer=True, **kwargs)
|
| 722 |
|
| 723 |
def get_output_embeddings(self):
|
|
@@ -886,6 +887,7 @@ class GptBertForSequenceClassification(GptBertModel):
|
|
| 886 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 887 |
|
| 888 |
def __init__(self, config: GptBertConfig, **kwargs):
|
|
|
|
| 889 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 890 |
|
| 891 |
self.num_labels = config.num_labels
|
|
@@ -941,6 +943,7 @@ class GptBertForTokenClassification(GptBertModel):
|
|
| 941 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 942 |
|
| 943 |
def __init__(self, config: GptBertConfig, **kwargs):
|
|
|
|
| 944 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 945 |
|
| 946 |
self.num_labels = config.num_labels
|
|
@@ -978,6 +981,7 @@ class GptBertForQuestionAnswering(GptBertModel):
|
|
| 978 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 979 |
|
| 980 |
def __init__(self, config: GptBertConfig, **kwargs):
|
|
|
|
| 981 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 982 |
|
| 983 |
self.num_labels = config.num_labels
|
|
@@ -1034,6 +1038,7 @@ class GptBertForMultipleChoice(GptBertModel):
|
|
| 1034 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 1035 |
|
| 1036 |
def __init__(self, config: GptBertConfig, **kwargs):
|
|
|
|
| 1037 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 1038 |
|
| 1039 |
self.num_labels = getattr(config, "num_labels", 2)
|
|
|
|
| 718 |
_tied_weights_keys = ["classifier.emb2vocab.weight"]
|
| 719 |
|
| 720 |
def __init__(self, config: GptBertConfig, **kwargs):
|
| 721 |
+
config.is_decoder = False
|
| 722 |
super().__init__(config, add_mlm_layer=True, **kwargs)
|
| 723 |
|
| 724 |
def get_output_embeddings(self):
|
|
|
|
| 887 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 888 |
|
| 889 |
def __init__(self, config: GptBertConfig, **kwargs):
|
| 890 |
+
config.is_decoder = False
|
| 891 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 892 |
|
| 893 |
self.num_labels = config.num_labels
|
|
|
|
| 943 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 944 |
|
| 945 |
def __init__(self, config: GptBertConfig, **kwargs):
|
| 946 |
+
config.is_decoder = False
|
| 947 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 948 |
|
| 949 |
self.num_labels = config.num_labels
|
|
|
|
| 981 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 982 |
|
| 983 |
def __init__(self, config: GptBertConfig, **kwargs):
|
| 984 |
+
config.is_decoder = False
|
| 985 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 986 |
|
| 987 |
self.num_labels = config.num_labels
|
|
|
|
| 1038 |
_keys_to_ignore_on_load_unexpected = ["classifier.emb2vocab.weight", "classifier.emb2vocab.bias"]
|
| 1039 |
|
| 1040 |
def __init__(self, config: GptBertConfig, **kwargs):
|
| 1041 |
+
config.is_decoder = False
|
| 1042 |
super().__init__(config, add_mlm_layer=False, **kwargs)
|
| 1043 |
|
| 1044 |
self.num_labels = getattr(config, "num_labels", 2)
|