Commit ea86bef5 authored by LysandreJik's avatar LysandreJik
Browse files

Check for None

parent e0f867a9
...@@ -327,7 +327,7 @@ class PreTrainedModel(nn.Module): ...@@ -327,7 +327,7 @@ class PreTrainedModel(nn.Module):
else: else:
first_module.weight = second_module.weight first_module.weight = second_module.weight
if hasattr(first_module, 'bias'): if hasattr(first_module, 'bias') and first_module.bias is not None:
first_module.bias.data = torch.nn.functional.pad( first_module.bias.data = torch.nn.functional.pad(
first_module.bias.data, first_module.bias.data,
(0, first_module.weight.shape[0] - first_module.bias.shape[0]), (0, first_module.weight.shape[0] - first_module.bias.shape[0]),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment