enhance rewrite state_dict missing _metadata (#14348)
This commit is contained in:
@@ -1050,6 +1050,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
|
||||
# Handle the case where some state_dict keys shouldn't be saved
|
||||
if self._keys_to_ignore_on_save is not None:
|
||||
for ignore_key in self._keys_to_ignore_on_save:
|
||||
if ignore_key in state_dict.keys():
|
||||
del state_dict[ignore_key]
|
||||
|
||||
# If we save using the predefined names, we can load using `from_pretrained`
|
||||
|
||||
Reference in New Issue
Block a user