Takes a state dict and returns the state dict for a particular sub-model.
(checkpoint, key_prefix)
| 712 | |
| 713 | |
| 714 | def extract_sub_model(checkpoint, key_prefix): |
| 715 | """ |
| 716 | Takes a state dict and returns the state dict for a particular sub-model. |
| 717 | """ |
| 718 | |
| 719 | sub_model_state_dict = {} |
| 720 | keys = list(checkpoint.keys()) |
| 721 | for key in keys: |
| 722 | if key.startswith(key_prefix): |
| 723 | sub_model_state_dict[key.replace(key_prefix, "")] = checkpoint.get(key) |
| 724 | |
| 725 | return sub_model_state_dict |
| 726 | |
| 727 | |
| 728 | def convert_hifigan_checkpoint(checkpoint, config): |
no outgoing calls
no test coverage detected