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 our ARM64 build of TensorFlow. In the terminal window (right pane of MobaXTerm), execute the following commands (entering Y when prompted):
curl -L -o - https://bootstrap.pypa.io/get-pip.py | python3 - --user export PATH=~/.local/bin:$PATH pip install --user --index-url https://pip.neocortix.com/ tensorflow
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 download this file (mnist_deep_TF2_004.py) and transfer it to your Scalable Compute instance using MobaXTerm. 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 = Sun Nov 10 11:23:18 2019 Epoch 1, Loss: 0.0996, Accuracy: 96.99 %, Test Loss: 0.0453, Test Accuracy: 98.46 %, Time: 160.27 s Epoch 2, Loss: 0.0369, Accuracy: 98.89 %, Test Loss: 0.0298, Test Accuracy: 99.05 %, Time: 318.89 s Epoch 3, Loss: 0.0253, Accuracy: 99.18 %, Test Loss: 0.0399, Test Accuracy: 98.67 %, Time: 474.22 s Epoch 4, Loss: 0.0174, Accuracy: 99.46 %, Test Loss: 0.0307, Test Accuracy: 99.07 %, Time: 635.47 s Epoch 5, Loss: 0.0156, Accuracy: 99.52 %, Test Loss: 0.0313, Test Accuracy: 99.21 %, Time: 794.81 s end time = Sun Nov 10 11:36:33 2019 run time = 794.84 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, as shown below.
Congratulations! You have just used a Scalable Compute node to train a Deep Learning model using TensorFlow.