PyTorch
Resources
- ð PyTorch Documentation
- ð https://pytorch.org/tutorials/beginner/basics/intro.html - good first step into PyTorch, quick
- ðđ Pytorch Beginner Series by PyTorch ðĒ
- ðđ Pytorch for Deep Learning & Machine Learning ðĒ
- ð PyTorch Pocket Reference - good handbook, but using online documentation is better.
Recommended Learning Path
- PyTorch for Deep Learning & Machine Learning
- Learn PyTorch for deep learning in a day. Literally
- Use PyTorch to implement popular neural network models by yourself!
- Use in the real world for tasks.
Tools for Pytorch
Why PyTorch? Most popular framework.
PyTorch Workflow
- Get data ready (turn into tensors)
- Build or pick a pre-trained model
- Pick a loss function
- Build a training loop
- Fit a model to the data and make a prediction
- Evaluate the model
- Improve through experimentation
- Save and reload your trained data
Basic Training Loop
- Loop through the data
- Set the model to correct mode
- Forward pass
- Calculate the loss
- Optimizer zero grad
- Perform backpropagation on the loss with respect
- Step the optimizer (perform gradient descent)**
When to use GPU vs CPU? Sometimes, depending on your data/hardware, you might find that your model trains faster on CPU than GPU. Why is this?
- It could be that the overhead for copying data/model to and from the GPU outweighs the compute benefits offered by the GPU
- The CPU has better compute capability than GPU (depending on hardware)
So it is also important to learn how to effectively use GPU.