在 Apple Silicon 芯片的 Mac 上安装深度学习环境的最小示例。
说明:
苹果提高了安装 tensorflow 的相关依赖以及安装教程[^1]
pytorch 1.12 开始支持苹果自研芯片携带的 GPU,设备标记为 Metal Performance Shaders (mps)[^2]
conda create --name your_env python=3.9
conda activate your_env
# install tensorflow
# also see https://developer.apple.com/metal/tensorflow-plugin/
conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
# install pytorch
# follow official instruction
conda install -c pytorch pytorch torchvision torchaudio
# install jax and flax
conda install -c conda-forge jax jaxlib flax
# install transformers
# pip is better than conda
pip install transformers datasets
# install scientific packages
conda install pandas numpy scipy scikit-learn matplotlib
# install other packages
conda install jupyter jsonlines
安装完成,