(checkpoint)
| 667 | |
| 668 | |
| 669 | def conv_attn_to_linear(checkpoint): |
| 670 | keys = list(checkpoint.keys()) |
| 671 | attn_keys = ["query.weight", "key.weight", "value.weight"] |
| 672 | for key in keys: |
| 673 | if ".".join(key.split(".")[-2:]) in attn_keys: |
| 674 | if checkpoint[key].ndim > 2: |
| 675 | checkpoint[key] = checkpoint[key][:, :, 0, 0] |
| 676 | elif "proj_attn.weight" in key: |
| 677 | if checkpoint[key].ndim > 2: |
| 678 | checkpoint[key] = checkpoint[key][:, :, 0] |
| 679 | |
| 680 | |
| 681 | def convert_from_original_zero123_ckpt(checkpoint_path, original_config_file, extract_ema, device): |
no outgoing calls
no test coverage detected