PyTorch 2.15 supports MPS on Mac

PyTorch 2.15 supports MPS on Mac
2 min read

Version 2.15 of PyTorch, the machine learning library, brings FP8 format to Macs and significantly speeds up decoding of mixture-of-experts models (mixture-of-experts). According to the PyTorch team at Hugging Face, who announced it, the version also includes new Metal kernels for audio, video, and training. The MPS backend targeted by these efforts allows running PyTorch models on Mac GPUs.

  • PyTorch 2.15 ajoute le format FP8 sur Mac et accélère le décodage des modèles mixture-of-experts.
  • Les modèles de langage décodent jusqu’à 6,5 fois plus vite qu’avec la version 2.14.
  • Les tenseurs FP8 réduisent de moitié la mémoire nécessaire aux poids par rapport à FP16 ou BF16.
  • Un nouveau padding en Metal réduit la mémoire du VAE de Wan2.2 à environ 8 GiB et corrige un bug de Qwen-Image-2.1.

For language models, the most visible gain concerns mixture-of-experts models, where each layer distributes tokens among several experts. According to the source, these models decode 5 to 6.5 times faster than with PyTorch 2.14. On an M3 Ultra with torch.compile, Qwen3.6-35B-A3B goes from 9.4 to 61.3 tokens per second, and LFM2.5-8B-A1B from 23.6 to 123.6 tokens per second. Dense models also benefit from faster linear layers. Text sampling is accelerated by softmax computation: on a logits line of size [1, 128256] in FP32, time drops from 57 µs to 7 µs, about eight times faster than the MPSGraph version.

FP8 arrives on Mac

PyTorch 2.15 adds torch.float8_e4m3fn tensors on MPS. Each value occupies one byte, half the space of FP16 or BF16, reducing the memory needed for a model’s weights. These tensors multiply with F.scaled_mm, which handles scaling per tensor and per row. The source also indicates that other operations supported on CUDA and CPU are now supported on MPS.

Video generation performance is also affected. Decoding Wan2.2’s tiled VAE raised the driver memory to 270 GiB, as constant padding generated 8,764 calls on a full decode in 28 tiles. With padding rewritten in Metal, the peak drops to about 8 GiB. The same change fixes a bug reported in ComfyUI, where Qwen-Image-2.1’s VAE encoder silently altered images on MPS. A round-trip encode-decode now reaches 29.95 dB PSNR compared to the CPU, versus 10.06 dB previously.

To use the version, a Mac with an Apple silicon chip, macOS 15 or later, and Python 3.11 or later are required. The team states that the release candidate can be installed in a separate environment with the command uv pip install torch==2.15.0, using a dedicated index. They also specify that MPS availability checks now indicate the reason for failure, such as an outdated operating system or absence of a Metal GPU.

S’abonner
Notification pour
guest

0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
0
Nous aimerions avoir votre avis, veuillez laisser un commentaire.x