How to run TensorFlow on Apple Mac M1, M2 with GPU support
2022. 12. 15. 23:37ㆍStable Diffusion Related Resources
How to run TensorFlow on Apple Mac M1, M2 with GPU support
1. Xcode command-line tools: xcode-select --install
2. anaconda(miniconda) setup
https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
source ~/miniconda/bin/activate
3. Install tensorflow-deps for apple mac
conda install -c apple tensorflow-deps
4. Install TensorFlow (Base)
python -m pip install tensorflow-macos
5. Install tensorflow-metal plug-in
python -m pip install tensorflow-metal
6. Run tensorflow codes
import tensorflow as tf
cifar = tf.keras.datasets.cifar100
(x_train, y_train), (x_test, y_test) = cifar.load_data()
model = tf.keras.applications.ResNet50(
include_top=True,
weights=None,
input_shape=(32, 32, 3),
classes=100,)
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)
'Stable Diffusion Related Resources' 카테고리의 다른 글
Zero-1-3: Zero-Shot One Image to 3D Object : 한 장의 사진을 다른 각도의 3D 형태로 재구성 (1) | 2023.03.21 |
---|---|
Getty Images는 Stability AI를 제소 (0) | 2023.03.20 |
2D image to 3D model (mesh) AI free : Point E (0) | 2022.12.21 |
Diffusers v0.11.0 Released (0) | 2022.12.20 |
InvokeAI 2.2.4 (2022-12-12) Release (0) | 2022.12.13 |