(path)
| 74 | |
| 75 | |
| 76 | def load_state_dict(path): |
| 77 | path = str(path) |
| 78 | if path.endswith('.safetensors'): |
| 79 | sd = load_safetensors(path) |
| 80 | else: |
| 81 | sd = torch.load(path, weights_only=True) |
| 82 | for key in sd: |
| 83 | if key.endswith('scale_input') or key.endswith('scale_weight'): |
| 84 | raise ValueError('fp8_scaled weights are not supported. Please use bf16 or normal fp8 weights.') |
| 85 | return sd |
| 86 | |
| 87 | |
| 88 | def iterate_safetensors(path): |