# Run an NNI Experiment in cnvrg

NNI is an incredibly powerful framework for training and tuning Neural Networks. It has many strengths including ease-of-use, scalability, flexibility and efficiency.

You can can use NNI in cnvrg to get the benefits of both: the dynamic machine learning of NNI and the powerful MLOps functionality of cnvrg. This tutorial will run through an example using the NNI mnist example project.

By following this tutorial, you will learn how to do it for yourself and run your new and existing NNI experiments in cnvrg.

# Add the NNI Docker Image

We will be using a pre-built public NNI image as part of this tutorial. Let's add it to your organization first.

To add the required docker image, got to Containers:

  1. Click Add Image.
  2. Click Pull Image in the pop up window.
  3. On the next screen fill in the following details:
    • Registry: Docker Hub
    • Repository: msranni/nni
    • Tag: latest
  4. Click Add.

You will now have added the required Docker image to cnvrg.

Now we will create a project and link it with the example NNI git repository.

Go to the Projects tab:

  1. Click New Project.
  2. Set the Title as nni.
  3. On the page that loads, click Link to git repository
  4. In the Git Integration panel, set:
    • Git Repo: https://github.com/Microsoft/nni.git
    • Git Branch: v1.6
  5. Click Save.

After following the above steps, you have now got everything set up! We can open a workspace and get started using NNI.

# Start a JupyterLab Workspace

Let's start a workspace and get started using NNI.

Go to the Workspaces tab of your nni project:

  1. Click Start a Workspace.
  2. In the panel that appears, set:
    • Type: JupyterLab
    • Compute: medium
    • Image: msranni/nni:latest
  3. Click Start workspace.

The workspace will now start initializing, cnvrg will do all of the MLOps work, connecting to the compute, pulling the required container, cloning the git repository and getting JupyterLab ready.

When JupyterLab is up and running, move on to the next step.

# Run an NNI Experiment

Now that you have JupyterLab running in an NNI environment, we can run an experiment.

  1. Start a new Terminal session inside Jupyter.
  2. Enter and run the following command:
    nnictl create --config nnictl create --config examples/trials/mnist-tfv1/config.yml --port 6006
    
  3. Inside the terminal, you should see feedback. Once the logs say INFO: Successfully started experiment!, the experiment will have started.
  4. Click on Tensorboard icon on the workspace's sidebar. The NNI web ui will appear.

There you go! Now you can keep track of the mnist NNI experiment from the ui!

# Conclusion

As you can see, using NNI in cnvrg is very easy. Now you can use your own custom code with the Docker image we added in this tutorial to run your own custom NNI experiments.

Last Updated: 7/6/2020, 6:13:05 AM