How to use Apple Silicon in pytorch instead of CUDA?

If we want to use Apple Silicon M series to train or fine-tune any model with PyTorch, do we need to just change the device from CUDA to MPS? Is that it or we may encounter some issues and bugs? How about the production; do we need to just change it from MPS to CUDA or CPU?