Update load_pretrained_model.py

fix bug
This commit is contained in:
zhifu gao 2024-01-17 10:57:14 +08:00 committed by GitHub
parent 8a28435485
commit e67ed1d45d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,7 @@ def load_pretrained_model(
src_state = {k: v for k, v in src_state.items() if not k.startswith(e)}
dst_state = obj.state_dict()
src_state = assigment_scope_map(dst_state, src_state, scope_map)
dst_state = assigment_scope_map(dst_state, src_state, scope_map)
if ignore_init_mismatch:
src_state = filter_state_dict(dst_state, src_state)
@ -115,4 +115,4 @@ def load_pretrained_model(
logging.debug("Loaded src_state keys: {}".format(src_state.keys()))
logging.debug("Loaded dst_state keys: {}".format(dst_state.keys()))
# dst_state.update(src_state)
obj.load_state_dict(dst_state)
obj.load_state_dict(dst_state)