Check https://pytorch.org/. You will see that "MacOS Binaries dont support CUDA, install from source if CUDA is needed". However, you can still get performance boosts (this will depend on your hardware) by installing the MPS accelerated version of pytorch by:
# MPS acceleration is available on MacOS 12.3+
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
This command can be generated here: https://pytorch.org/

And in order to install different Torch versions on different platorms you can use conditionals in your requirements.txt
like this
# for CUDA 11.3 torch on Linux
--find-links https://download.pytorch.org/whl/cu113/torch_stable.html; sys_platform == "linux"
torch==1.10.2; sys_platform == "linux"
torchvision==0.11.3; sys_platform == "linux"
pytorch-lightning==1.5.10; sys_platform == "linux"
# for MPS accelerated torch on Mac
--pre --extra-index-url https://download.pytorch.org/whl/nightly/cpu; sys_platform == "darwin"
torch==1.10.2; sys_platform == "darwin"
torchvision==0.11.3; sys_platform == "darwin"
pytorch-lightning==1.5.10; sys_platform == "darwin"
# for CPU torch on Mac
# torch==1.10.2; sys_platform == "darwin"
# torchvision==0.11.3; sys_platform == "darwin"
# pytorch-lightning==1.5.10; sys_platform == "darwin"
This will install CUDA enabled torch and torchvision on Linux but the MPS accelerated version of them on MacOS