Updates paths inside attentions to the new naming scheme (local renaming)
(old_list, n_shave_prefix_segments=0)
| 227 | |
| 228 | |
| 229 | def renew_attention_paths(old_list, n_shave_prefix_segments=0): |
| 230 | """ |
| 231 | Updates paths inside attentions to the new naming scheme (local renaming) |
| 232 | """ |
| 233 | mapping = [] |
| 234 | for old_item in old_list: |
| 235 | new_item = old_item |
| 236 | |
| 237 | # new_item = new_item.replace('norm.weight', 'group_norm.weight') |
| 238 | # new_item = new_item.replace('norm.bias', 'group_norm.bias') |
| 239 | |
| 240 | # new_item = new_item.replace('proj_out.weight', 'proj_attn.weight') |
| 241 | # new_item = new_item.replace('proj_out.bias', 'proj_attn.bias') |
| 242 | |
| 243 | # new_item = shave_segments(new_item, n_shave_prefix_segments=n_shave_prefix_segments) |
| 244 | |
| 245 | mapping.append({"old": old_item, "new": new_item}) |
| 246 | |
| 247 | return mapping |
| 248 | |
| 249 | |
| 250 | def convert_ldm_unet_checkpoint( |
no outgoing calls
no test coverage detected