Skip to content

Commit

Permalink
update logging for mismatch name
Browse files Browse the repository at this point in the history
  • Loading branch information
ftshijt committed Nov 7, 2021
1 parent 8197b40 commit e3051d8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions espnet2/torch_utils/load_pretrained_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ def filter_state_dict(
if key in dst_state and (dst_state[key].size() == src_state[key].size()):
match_state[key] = value
else:
logging.warning(
f"Filter out {key} from pretrained dict"
+ " because of name/size"
+ f"({dst_state[key].size()}-{src_state[key].size()})"
)
if key not in dst_state:
logging.warning(
f"Filter out {key} from pretrained dict"
+ " because of name not found in target dict"
)
else:
logging.warning(
f"Filter out {key} from pretrained dict"
+ " because of size mismatch"
+ f"({dst_state[key].size()}-{src_state[key].size()})"
)
return match_state


Expand Down

0 comments on commit e3051d8

Please sign in to comment.