Skip to content

Instantly share code, notes, and snippets.

@Apurer
Last active October 26, 2022 15:51
Show Gist options
  • Select an option

  • Save Apurer/6e50ed4db5733bea6e962bd782935c82 to your computer and use it in GitHub Desktop.

Select an option

Save Apurer/6e50ed4db5733bea6e962bd782935c82 to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir ~/Development/
cd ~/Development/
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -P ~/Development/
bash ~/Development/Miniconda3-latest-MacOSX-arm64.sh -b -p $HOME/miniconda
source ~/miniconda/bin/activate
conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
python -m pip install numpy --upgrade
echo 'import tensorflow as tf\ncifar = tf.keras.datasets.cifar100\n(x_train, y_train), (x_test, y_test) = cifar.load_data()\nmodel = tf.keras.applications.ResNet50(\n include_top=True,\n weights=None,\n input_shape=(32, 32, 3),\n classes=100,)\nloss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)\nmodel.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])\nmodel.fit(x_train, y_train, epochs=5, batch_size=64)' > ~/Development/tensor_test.py
time python -m ~/Development/tensor_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment