Skip to content

k-forghani/pytorch-workshop

Repository files navigation

PyTorch Beginner Workshop

Introduction

These are the updated versions of notebooks used in the PyTorch Beginner Series YouTube playlist, created by Brad Heintz.

Outline

Title Video Notebook
1 Introduction to PyTorch + +
2 Introduction to PyTorch Tensors + +
3 The Fundamentals of Autograd + +
4 Building Models with PyTorch + +
5 PyTorch TensorBoard Support + +
6 Training with PyTorch + +
7 Model Understanding with Captum + +
8 Production Inference Deployment with PyTorch + +

Installation

Follow one of the methods below to set up everything and install all necessary dependencies.

Method 1: Manual Way

Installing Miniconda

  1. Install miniconda (or anaconda).
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh

~/miniconda3/bin/conda init bash
conda config --set auto_activate_base false
  1. Change the solver to speed up the process of installing new packages.
conda update -n base conda
conda install -n base conda-libmamba-solver
conda config --set solver libmamba

conda config --add channels conda-forge

Setting up the Environment

  1. Create a new conda environment.
conda create -n ai -y
  1. Install essential packages.
conda install -c conda-forge -n ai jupyterlab numpy matplotlib -y
conda install -c pytorch -c nvidia -n ai pytorch torchvision torchaudio pytorch-cuda=12.1 -y

Replace 12.1 with your cuda version extracted from the nvidia-smi output.

  1. Install TensorBoard.
conda install -c conda-forge -n ai tensorboard -y

If you encounter any problems due to incompatibility with the latest NumPy version, run the following commands instead:

conda activate ai
pip3 install tb-nightly
  1. Install captum.
conda install -c pytorch -n ai captum -y
pip install --upgrade --quiet jupyter_client ipywidgets
conda install -c conda-forge -n ai flask flask-compress
  1. Export installed packages for further use.
conda activate ai
conda env export > environment.yml
pip3 freeze > requirements.txt

Method 2: Automatic Way

conda env create -f environment.yml
conda activate ai
pip3 install -r requirements.txt