MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / extract_sub_model

Function extract_sub_model

scripts/convert_original_audioldm2_to_diffusers.py:714–725  ·  view source on GitHub ↗

Takes a state dict and returns the state dict for a particular sub-model.

(checkpoint, key_prefix)

Source from the content-addressed store, hash-verified

712
713
714def 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
728def convert_hifigan_checkpoint(checkpoint, config):

Calls

no outgoing calls

Tested by

no test coverage detected