mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Check None before going through iteration (#13250)
* Check None before going through iteration * Format
This commit is contained in:
parent
774760e6f3
commit
d50649531f
@ -1411,7 +1411,9 @@ class Trainer:
|
||||
load_result = self.model.load_state_dict(state_dict, strict=False)
|
||||
|
||||
if len(load_result.missing_keys) != 0:
|
||||
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(
|
||||
self.model._keys_to_ignore_on_save
|
||||
):
|
||||
self.model.tie_weights()
|
||||
else:
|
||||
logger.warn(f"There were missing keys in the checkpoint model loaded: {load_result.missing_keys}.")
|
||||
|
Loading…
Reference in New Issue
Block a user