This repository was archived by the owner on Jun 29, 2019. It is now read-only.
readme.md - #5
Open
Vicky Fu (VickiFu) wants to merge 7 commits into
Open
Conversation
fixed typos
SDK version updated
SDK version updated
Author
|
I update the commend line for attaching resource. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Classify MNIST dataset using TensorFlow
This sample uses the popular TensorFlow machine learning library from Google to classify the ageless MNIST dataset of handwritten digits.
Logging code
The sample code is directly copied from TensorFlow sample code collections on GitHub. The only change we make is to add some Azure ML specific logging code into the experiment.
Here are the relevant code snippets:
By adding the above logging code, when the run finishes, you can find the following graph plotted for you in the run history detail page.
Instructions for running scripts from CLI window
You can run the scripts from the Workbench app, but it is more interesting to run it from the command-line window so you can watch the feedback in real-time.
Open the command-line window by clicking on File --> Open Command Prompt, then run
tf_mnist.pyin local Python environment installed by Azure ML Workbench by typing in the following command.If you have Docker engine running locally, you can run
tf_mnist.pyin a Docker container.And you don't need to pip-install the tensorflow library, since it is already specified in the
conda_depeendencies.ymlfile underaml_configfolder. The execution engine will automatically install it for as part of the Docker image building process.You can also run
tf_mnist.pyin a Docker container in a remote machine. Note you need to create/configure myvm.compute.Running it on a VM with GPU
With computationally expensive tasks like training a neural network, you can get a huge performance boost by running it on a GPU-equipped machine.
Step 1. Provision a GPU Linux VM
Create an Ubuntu-based Data Science Virtual Machine(DSVM) in Azure portal using one of the NC-series VM templates. NC-series VMs are the VMs equipped with GPUs for computation.
Step 2. Attach the compute context
Run following command to add the GPU VM as a compute target in your current project:
The above command creates a
myvm.computeandmyvm.runconfigfile under theaml_configfolder.Step 3. Modify the configuration files under aml_config folder
You need the TensorFlow library built for GPU:
In
conda_dependencies.ymlfile, replacetensorflowwithtensorflow-gpu.You need a different base Docker image with CUDA libraries preinstalled:
In
myvm.computefile, replace the value ofbaseImagefrommicrosoft/mmlspark:plus-0.7.91tomicrosoft/mmlspark:plus-gpu-0.7.91You need to use NvidiaDocker command to start the Docker container as opposed to the regular docker command.
In
myvm.computefile, add a line:nvidiaDocker: trueYou need to specify the run time framework as Python as opposed to PySpark:
In
myvm.runconfigfile, change the value ofFrameworkfromPySparktoPython.Step 4. Run the script.
Now you are ready to run the script.
You should notice the script finishes significantly faster than than if you use CPU. And the command-line outputs should indicate that GPU is used for executing this script.