TensorFlow Quick Setup

  1. Launch an Inf1.6xlarge Instance:
    • Please follow the instructions at launch an Amazon EC2 Instance to Launch an Inf1 instance, when choosing the instance type at the EC2 console. Please make sure to select the correct instance type. To get more information about Inf1 instances sizes and pricing see Inf1 web page.

    • When choosing an Amazon Machine Image (AMI) make sure to select Deep Learning AMI with Conda Options. Please note that Neuron Conda environments are supported only in Ubuntu 18 DLAMI and Amazon Linux2 DLAMI, Neuron Conda environments are not supported in Amazon Linux DLAMI.

    • After launching the instance, follow the instructions in Connect to your instance to connect to the instance

    Note

    You can also launch the instance from AWS CLI, please see AWS CLI commands to launch inf1 instances.

  2. Set up a development environment:
    • Enable or install TensorFlow-Neuron:

      To activate TensorFlow 1.x:

      source activate aws_neuron_tensorflow_p36
      

      To activate TensorFlow 2.x:

      # Setup a new Python virtual environment
      sudo apt-get install python3-venv
      python3 -m venv neuron_tf2_env
      source neuron_tf2_env/bin/activate
      pip install --upgrade pip
      pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
      pip install tensorflow-neuron[cc]
      pip install ipykernel
      python -m ipykernel install --user --name neuron_tf2 --display-name "Python (Neuron TensorFlow 2)"
      pip install jupyter notebook
      pip install environment_kernels
      
  3. Run tutorial in Jupyter notebook:
    • Follow instruction at Setup Jupyter notebook to:

      1. Start the Jupyter Notebook on the instance

      2. Run the Jupyter Notebook from your local browser

    • Connect to the instance from the terminal, clone the Neuron Github repository to the Inf1 instance and then change the working directory to the tutorial directory:

      git clone https://github.com/aws/aws-neuron-sdk.git
      cd aws-neuron-sdk/src/examples/tensorflow
      
    • Locate the tutorial notebook file (.ipynb file) under aws-neuron-sdk/src/examples/tensorflow

    • From your local browser, open the tutorial notebook from the menu and follow the instructions.