"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "58c789e3d226a35e6ff6e2d175a5d0b78ef1fc04"
Unverified Commit d5064953 authored by Li-Huai (Allan) Lin's avatar Li-Huai (Allan) Lin Committed by GitHub
Browse files

Check None before going through iteration (#13250)

* Check None before going through iteration

* Format
parent 774760e6
...@@ -1411,7 +1411,9 @@ class Trainer: ...@@ -1411,7 +1411,9 @@ class Trainer:
load_result = self.model.load_state_dict(state_dict, strict=False) load_result = self.model.load_state_dict(state_dict, strict=False)
if len(load_result.missing_keys) != 0: 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() self.model.tie_weights()
else: else:
logger.warn(f"There were missing keys in the checkpoint model loaded: {load_result.missing_keys}.") logger.warn(f"There were missing keys in the checkpoint model loaded: {load_result.missing_keys}.")
......
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