This assignment introduces you to PyTorch and demonstrates the process of training a simple MNIST classification model. You will compare the performance of different hardware configurations (CPU vs. GPU) while executing the tasks in Google Colaboratory (Colab).
- Gain familiarity with PyTorch for machine learning and deep learning tasks.
- Train a simple neural network model to classify the MNIST dataset.
- Compare performance differences between CPU and GPU execution.
We will use Google Colaboratory (Colab) for this assignment. Colab provides access to Python, GPUs, and TPUs, so you don't need to install anything on your machine. However, the code can also be run locally on Linux (or Windows WSL) with the necessary libraries installed, such as Python, Numpy, Matplotlib, and PyTorch.
MNIST is a dataset widely used in AI as the "Hello world" of machine learning. To learn more, visit the MNIST Wikipedia page.
- Text-based tutorial: PyTorch Tutorials
- Video tutorial: Deep Learning with PyTorch: A 60 Minute Blitz
Go over these resources to familiarize yourself with PyTorch.
- Open and work through the Colab notebook:
PyTorch and MNIST Training Colab Notebook - Complete the 10 questions in the notebook. These questions are numbered and bolded.
- Finish all sections of the Colab notebook.
- Export your notebook as a PDF:
- Navigate to File > Print > Adobe PDF in Colab.
- Upload the PDF to GitHub Classroom by committing it to your private assignment repository.
- If you encounter any issues with PyTorch or Colab, consult the provided tutorials or reach out during office hours.
- Be sure to test the performance difference between CPU and GPU for an understanding of the hardware's impact on training time.
Happy coding!