In this tutorial, we will show you how to install and run TensorFlow, the free Deep Learning framework by Google, onto a Scalable Compute node.
First, we start by Launching A Single Node (Web Interface), using the instructions in the previous tutorial, and using the MobaXTerm terminal window, to allow you to transfer your training data, training script, and trained model. Make sure your MobaXTerm terminal is set to use SCP protocol, as shown below in Red:
Here is how it looks when we have launched the node and connected to it using MobaXTerm:
You will be logged in as root, in the
/root
directory. Next, you will install an ARM64 build of TensorFlow. In the terminal window (right pane of MobaXTerm), execute the following commands (entering Y when prompted):
export PATH=~/.local/bin:$PATH pip install --user tensorflow-aarch64 -f https://tf.kmtea.eu/whl/stable.html
Here is an example training script which trains a 5-layer Deep Convolutional Neural Network on the famous MNIST handwritten character set and achieves about 99.2% accuracy. Please use this command to download our file (mnist_deep_TF2_004.py) to your Scalable Compute instance:
curl -sSL -O https://neocortix.com/documents/mnist_deep_TF2_004.py
Then you can begin training with the following command:
python3 mnist_deep_TF2_004.py
The output should look something like this:
MNIST Deep Benchmark start time = Thu Oct 7 01:47:26 2021 Epoch 1, Loss: 0.1006, Accuracy: 96.91 %, Test Loss: 0.0668, Test Accuracy: 97.90 %, Time: 191.27 s Epoch 2, Loss: 0.0379, Accuracy: 98.83 %, Test Loss: 0.0322, Test Accuracy: 98.95 %, Time: 414.36 s Epoch 3, Loss: 0.0254, Accuracy: 99.22 %, Test Loss: 0.0351, Test Accuracy: 98.89 %, Time: 633.33 s Epoch 4, Loss: 0.0208, Accuracy: 99.37 %, Test Loss: 0.0280, Test Accuracy: 99.19 %, Time: 816.50 s Epoch 5, Loss: 0.0158, Accuracy: 99.51 %, Test Loss: 0.0260, Test Accuracy: 99.19 %, Time: 1035.71 s end time = Thu Oct 7 02:04:42 2021 run time = 1035.72 s
And finally, you can use MobaXterm to transfer the trained model back to your host machine.
Congratulations! You have trained a TensorFlow model on a Scalable Compute node, and transfered it back to your host machine.
When you are finished with this tutorial, don't forget to exit your terminal session by using CTRL-C or issuing the logout command. And then be sure to terminate your device session and stop the billing by clicking the Stop button the Scalable Compute Web Interface page.
Congratulations! You have just used a Scalable Compute node to train a Deep Learning model using TensorFlow.