This document is relevant for: Inf1
PyTorch Neuron (“torch-neuron”) Setup on Ubuntu 20 with Pytorch DLAMI#
Get Started with Latest Release of PyTorch Neuron (torch-neuron
)#
This section provide links that will assist you to quickly start with a fresh installation of PyTorch Neuron (torch-neuron) Setup.
Launch the Instance
Please follow the instructions at launch an Amazon EC2 Instance to launch an instance. When choosing the instance type at the EC2 console. please make sure to select the correct instance type.
To get more information about instances sizes and pricing see: Inf1 web page
Check for the latest version of the DLAMI Neuron Pytorch 1.13 AMI and copy the AMI name that starts with “Deep Learning AMI Neuron PyTorch 1.13 (Ubuntu 20.04) <latest_date>” from “AMI Name:” section
Search for the copied AMI name in the AMI Search , you should see an exact matching AMI with the AMI name in Community AMIs. Select the AMI and use it to launch the instance.
After launching the instance, follow the instructions in Connect to your instance to connect to the instance
Update Neuron Drivers
# Update OS packages
sudo apt-get update -y
# Update OS headers
sudo apt-get install linux-headers-$(uname -r) -y
# Install git
sudo apt-get install git -y
# upgrade Neuron Driver
sudo apt-get upgrade aws-neuronx-dkms=2.* -y --allow-change-held-packages
# Update Neuron Runtime
sudo apt-get upgrade aws-neuronx-collectives=.* -y --allow-change-held-packages
sudo apt-get upgrade aws-neuronx-runtime-lib=.* -y --allow-change-held-packages
# Update Neuron Tools
sudo apt-get upgrade aws-neuronx-tools=2.* -y --allow-change-held-packages
# Add PATH
export PATH=/opt/aws/neuron/bin:$PATH
Get Started With Pytorch DLAMI
# Activate Python venv
source /opt/aws_neuron_venv_pytorch_inf1/bin/activate
# Install Jupyter notebook kernel
pip install ipykernel
python3.9 -m ipykernel install --user --name aws_neuron_venv_pytorch_inf1 --display-name "Python (torch-neuron)"
pip install jupyter notebook
pip install environment_kernels
# Set pip repository pointing to the Neuron repository
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
# Update PyTorch Neuron
python -m pip install --upgrade torch-neuron neuron-cc[tensorflow] "protobuf" torchvision
Update to latest PyTorch Neuron (torch-neuron
)#
If you already have a previous Neuron release installed, this section provide links that will assist you to update to latest Neuron release.
Note
For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.
# Activate Python venv
source /opt/aws_neuron_venv_pytorch_inf1/bin/activate
# Install Jupyter notebook kernel
pip install ipykernel
python3.9 -m ipykernel install --user --name aws_neuron_venv_pytorch_inf1 --display-name "Python (torch-neuron)"
pip install jupyter notebook
pip install environment_kernels
# Set pip repository pointing to the Neuron repository
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
# Update PyTorch Neuron
python -m pip install --upgrade torch-neuron neuron-cc[tensorflow] "protobuf" torchvision
Install Previous PyTorch Neuron Releases for Ubuntu (torch-neuron
)#
This section will assist you to install previous Neuron releases.
# Install Python venv
sudo apt-get install -y python3.8-venv g++
# Create Python venv
python3.8 -m venv aws_neuron_venv_pytorch_inf1
# Activate Python venv
source aws_neuron_venv_pytorch_inf1/bin/activate
python -m pip install -U pip
# Install Jupyter notebook kernel
pip install ipykernel
python3.8 -m ipykernel install --user --name aws_neuron_venv_pytorch_inf1 --display-name "Python (torch-neuron)"
pip install jupyter notebook
pip install environment_kernels
# Set pip repository pointing to the Neuron repository
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
# Install PyTorch Neuron
python -m pip install torch-neuron==1.13.1.2.11.13.0 neuron-cc[tensorflow] "protobuf" torchvision
# Install Python venv
sudo apt-get install -y python3.8-venv g++
# Create Python venv
python3.8 -m venv aws_neuron_venv_pytorch_inf1
# Activate Python venv
source aws_neuron_venv_pytorch_inf1/bin/activate
python -m pip install -U pip
# Install Jupyter notebook kernel
pip install ipykernel
python3.8 -m ipykernel install --user --name aws_neuron_venv_pytorch_inf1 --display-name "Python (torch-neuron)"
pip install jupyter notebook
pip install environment_kernels
# Set pip repository pointing to the Neuron repository
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
# Install PyTorch Neuron
python -m pip install torch-neuron==1.13.1.2.11.7.0 neuron-cc[tensorflow] "protobuf" torchvision
# Install Python venv
sudo apt-get install -y python3.8-venv g++
# Create Python venv
python3.8 -m venv aws_neuron_venv_pytorch_inf1
# Activate Python venv
source aws_neuron_venv_pytorch_inf1/bin/activate
python -m pip install -U pip
# Install Jupyter notebook kernel
pip install ipykernel
python3.8 -m ipykernel install --user --name aws_neuron_venv_pytorch_inf1 --display-name "Python (torch-neuron)"
pip install jupyter notebook
pip install environment_kernels
# Set pip repository pointing to the Neuron repository
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com
# Install PyTorch Neuron
python -m pip install torch-neuron==1.13.1.2.10.12.0 neuron-cc[tensorflow] "protobuf" torchvision
This document is relevant for: Inf1