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

Function renew_vae_resnet_paths

scripts/convert_unidiffuser_to_diffusers.py:48–61  ·  view source on GitHub ↗

Updates paths inside resnets to the new naming scheme (local renaming)

(old_list, n_shave_prefix_segments=0)

Source from the content-addressed store, hash-verified

46
47# Copied from diffusers.pipelines.stable_diffusion.convert_from_ckpt.renew_vae_resnet_paths
48def renew_vae_resnet_paths(old_list, n_shave_prefix_segments=0):
49 """
50 Updates paths inside resnets to the new naming scheme (local renaming)
51 """
52 mapping = []
53 for old_item in old_list:
54 new_item = old_item
55
56 new_item = new_item.replace("nin_shortcut", "conv_shortcut")
57 new_item = shave_segments(new_item, n_shave_prefix_segments=n_shave_prefix_segments)
58
59 mapping.append({"old": old_item, "new": new_item})
60
61 return mapping
62
63
64# Copied from diffusers.pipelines.stable_diffusion.convert_from_ckpt.renew_vae_attention_paths

Callers 1

convert_vae_to_diffusersFunction · 0.70

Calls 1

shave_segmentsFunction · 0.70

Tested by

no test coverage detected