(checkpoint)
| 542 | |
| 543 | |
| 544 | def conv_attn_to_linear(checkpoint): |
| 545 | keys = list(checkpoint.keys()) |
| 546 | attn_keys = ["to_q.weight", "to_k.weight", "to_v.weight"] |
| 547 | for key in keys: |
| 548 | if ".".join(key.split(".")[-2:]) in attn_keys: |
| 549 | if checkpoint[key].ndim > 2: |
| 550 | checkpoint[key] = checkpoint[key][:, :, 0, 0] |
| 551 | elif "proj_attn.weight" in key: |
| 552 | if checkpoint[key].ndim > 2: |
| 553 | checkpoint[key] = checkpoint[key][:, :, 0] |
| 554 | |
| 555 | |
| 556 | def renew_vae_resnet_paths(old_list, n_shave_prefix_segments=0, is_temporal=False): |
no outgoing calls
no test coverage detected