Bygning af pytorch på macOS kræver flere afhængigheder og overvejelser:
1. MACOS -version: Pytorch understøttes på MACOS 10.15 (Catalina) eller nyere [3]. For GPU -support på nyere MAC'er med M1/M2/M3 -chips er MACOS 12.3 eller nyere nødvendig [1].
2. Python -version: Det anbefales at bruge Python 3.9 til 3.12 til kompatibilitet med Pytorch [3].
3. PAKKE MANAGER: Du kan bruge enten PIP eller Anaconda til at installere Pytorch. Anaconda anbefales, da det giver et sandkasset miljø med alle nødvendige afhængigheder [3].
4. GPU -support: Traditionel CUDA -support er ikke tilgængelig på MACO'er, fordi CUDA kun arbejder med NVIDIA GPU'er, som typisk ikke findes i Macs [8]. Mac'er med M1/M2/M3 -chips kan imidlertid bruge MPS (Metal Performance Shaders) backend til GPU -acceleration. Dette kræver, at Pytorch installeres med MPS -support, som er tilgængelig i natlige builds [1].
5. Yderligere afhængigheder: For visse konfigurationer kan der være behov for yderligere værktøjer som Xcode, OpenBlas og OpenMP, især hvis du kompilerer Pytorch fra kilde [5]. Disse er imidlertid ikke typisk påkrævet til standardinstallationer ved hjælp af PIP eller Anaconda.
6. Installationsindeks: Pytorch-hjul er vært på specifikke indekser (f.eks. Bygninger kun er på `https: // download.pytorch.org/whl/cpu`), og du skal muligvis specificere disse indeks under installation afhængigt af Din hardware [2] [6].
Citater:[1] https://wiki.cci.arts.ac.uk/books/it-computing/page/enable-gpu-support-with-pytorch-macos
[2] https://docs.astral.sh/uv/guides/integration/pytorch/
[3] https://pytorch.org/get-started/locally/
[4] https://botpenguin.com/blogs/how-to-install-pytorch-a-trep-by-trep-guide
[5] https://github.com/tomheaven/pytorch-osx-build/blob/master/buildinstraktioner-1.0.1.md
[6] https://prefix-dev.github.io/pixi/dev/features/pytorch/
[7] https://stackoverflow.com/questions/73986257/pytorch-1-12-on-mac-monterey
[8] https://stackoverflow.com/questions/63423463/using-pytorch-cuda-on-macbook-pro