davda54 commited on
Commit
f010b43
·
verified ·
1 Parent(s): 938e36d

Fix compatibility with transformers v5

Browse files
Files changed (1) hide show
  1. modeling_norbert.py +2 -2
modeling_norbert.py CHANGED
@@ -227,9 +227,9 @@ class NorbertPreTrainedModel(PreTrainedModel):
227
  if isinstance(module, nn.Linear) or isinstance(module, nn.Embedding):
228
  nn.init.trunc_normal_(module.weight, mean=0.0, std=std, a=-2*std, b=2*std)
229
  elif isinstance(module, nn.LayerNorm) and module.weight is not None:
230
- module.weight.fill_(1.0)
231
  if hasattr(module, "bias") and module.bias is not None:
232
- module.bias.zero_()
233
 
234
 
235
  class NorbertModel(NorbertPreTrainedModel):
 
227
  if isinstance(module, nn.Linear) or isinstance(module, nn.Embedding):
228
  nn.init.trunc_normal_(module.weight, mean=0.0, std=std, a=-2*std, b=2*std)
229
  elif isinstance(module, nn.LayerNorm) and module.weight is not None:
230
+ nn.init.ones_(module.weight)
231
  if hasattr(module, "bias") and module.bias is not None:
232
+ nn.init.zeros_(module.bias)
233
 
234
 
235
  class NorbertModel(NorbertPreTrainedModel):