davda54 commited on
Commit
52fc641
·
verified ·
1 Parent(s): 1251650

Fix compatibility with transformers v5

Browse files
Files changed (1) hide show
  1. modeling_norbert.py +5 -5
modeling_norbert.py CHANGED
@@ -312,7 +312,7 @@ class NorbertModel(NorbertPreTrainedModel):
312
 
313
 
314
  class NorbertForMaskedLM(NorbertModel):
315
- _keys_to_ignore_on_load_unexpected = ["head"]
316
  _tied_weights_keys = {"classifier.nonlinearity.5.weight": "embedding.word_embedding.weight"}
317
 
318
  def __init__(self, config, **kwargs):
@@ -385,7 +385,7 @@ class Classifier(nn.Module):
385
 
386
 
387
  class NorbertForSequenceClassification(NorbertModel):
388
- _keys_to_ignore_on_load_unexpected = ["classifier"]
389
 
390
  def __init__(self, config, **kwargs):
391
  super().__init__(config, add_mlm_layer=False, **kwargs)
@@ -451,7 +451,7 @@ class NorbertForSequenceClassification(NorbertModel):
451
 
452
 
453
  class NorbertForTokenClassification(NorbertModel):
454
- _keys_to_ignore_on_load_unexpected = ["classifier"]
455
 
456
  def __init__(self, config, **kwargs):
457
  super().__init__(config, add_mlm_layer=False, **kwargs)
@@ -499,7 +499,7 @@ class NorbertForTokenClassification(NorbertModel):
499
 
500
 
501
  class NorbertForQuestionAnswering(NorbertModel):
502
- _keys_to_ignore_on_load_unexpected = ["classifier"]
503
 
504
  def __init__(self, config, **kwargs):
505
  super().__init__(config, add_mlm_layer=False, **kwargs)
@@ -567,7 +567,7 @@ class NorbertForQuestionAnswering(NorbertModel):
567
 
568
 
569
  class NorbertForMultipleChoice(NorbertModel):
570
- _keys_to_ignore_on_load_unexpected = ["classifier"]
571
 
572
  def __init__(self, config, **kwargs):
573
  super().__init__(config, add_mlm_layer=False, **kwargs)
 
312
 
313
 
314
  class NorbertForMaskedLM(NorbertModel):
315
+ _keys_to_ignore_on_load_unexpected = ["head", r".*position_indices.*"]
316
  _tied_weights_keys = {"classifier.nonlinearity.5.weight": "embedding.word_embedding.weight"}
317
 
318
  def __init__(self, config, **kwargs):
 
385
 
386
 
387
  class NorbertForSequenceClassification(NorbertModel):
388
+ _keys_to_ignore_on_load_unexpected = ["classifier", r".*position_indices.*"]
389
 
390
  def __init__(self, config, **kwargs):
391
  super().__init__(config, add_mlm_layer=False, **kwargs)
 
451
 
452
 
453
  class NorbertForTokenClassification(NorbertModel):
454
+ _keys_to_ignore_on_load_unexpected = ["classifier", r".*position_indices.*"]
455
 
456
  def __init__(self, config, **kwargs):
457
  super().__init__(config, add_mlm_layer=False, **kwargs)
 
499
 
500
 
501
  class NorbertForQuestionAnswering(NorbertModel):
502
+ _keys_to_ignore_on_load_unexpected = ["classifier", r".*position_indices.*"]
503
 
504
  def __init__(self, config, **kwargs):
505
  super().__init__(config, add_mlm_layer=False, **kwargs)
 
567
 
568
 
569
  class NorbertForMultipleChoice(NorbertModel):
570
+ _keys_to_ignore_on_load_unexpected = ["classifier", r".*position_indices.*"]
571
 
572
  def __init__(self, config, **kwargs):
573
  super().__init__(config, add_mlm_layer=False, **kwargs)