We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 774760e commit d506495Copy full SHA for d506495
src/transformers/trainer.py
@@ -1411,7 +1411,9 @@ def _load_state_dict_in_model(self, state_dict):
1411
load_result = self.model.load_state_dict(state_dict, strict=False)
1412
1413
if len(load_result.missing_keys) != 0:
1414
- if set(load_result.missing_keys) == set(self.model._keys_to_ignore_on_save):
+ if self.model._keys_to_ignore_on_save is not None and set(load_result.missing_keys) == set(
1415
+ self.model._keys_to_ignore_on_save
1416
+ ):
1417
self.model.tie_weights()
1418
else:
1419
logger.warn(f"There were missing keys in the checkpoint model loaded: {load_result.missing_keys}.")
0 commit comments