davda54 commited on
Commit
ef18fbe
·
verified ·
1 Parent(s): 5e659fd

Fix compatibility with transformers v5

Browse files
Files changed (1) hide show
  1. modeling_norbert.py +1 -1
modeling_norbert.py CHANGED
@@ -235,7 +235,7 @@ class NorbertPreTrainedModel(PreTrainedModel):
235
  nn.init.trunc_normal_(module.weight.data, mean=0.0, std=std, a=-2*std, b=2*std)
236
  elif isinstance(module, nn.LayerNorm) and module.weight is not None:
237
  module.weight.data.fill_(1.0)
238
- if module.bias is not None:
239
  module.bias.data.zero_()
240
 
241
 
 
235
  nn.init.trunc_normal_(module.weight.data, mean=0.0, std=std, a=-2*std, b=2*std)
236
  elif isinstance(module, nn.LayerNorm) and module.weight is not None:
237
  module.weight.data.fill_(1.0)
238
+ if hasattr(module, "bias") and module.bias is not None:
239
  module.bias.data.zero_()
240
 
241