Download export/custom_stft.coreml.patch from milestonemade/Kokoro-82M-CoreML-Masked: direct link, hf CLI and curl.
- Browser
- Download file 765 Bytes
-
https://huggingface.co/milestonemade/Kokoro-82M-CoreML-Masked/resolve/main/export/custom_stft.coreml.patch
- Command line
-
hf download hf://milestonemade/Kokoro-82M-CoreML-Masked/export/custom_stft.coreml.patch
-
curl -L -o custom_stft.coreml.patch https://huggingface.co/milestonemade/Kokoro-82M-CoreML-Masked/resolve/main/export/custom_stft.coreml.patch
765 Bytes
| --- ref/kokoro/custom_stft.py | |
| +++ ref/kokoro/custom_stft.py | |
| # PyTorch and ONNX handle atan2(0, negative) differently | |
| # PyTorch returns π, ONNX returns -π | |
| # Manual correction ensures consistent behavior across platforms | |
| - correction_mask = (imag_out == 0) & (real_out < 0) | |
| - phase[correction_mask] = torch.pi | |
| - return magnitude, phase | |
| + # CoreML-friendly: float-mask blend instead of bitwise-and + boolean scatter. | |
| + correction = (imag_out == 0).to(phase.dtype) * (real_out < 0).to(phase.dtype) | |
| + phase = phase * (1.0 - correction) + torch.pi * correction | |
| + return magnitude, phase | |
| def inverse(self, magnitude: torch.Tensor, phase: torch.Tensor, length=None): | |