Machine Learning with PyTorch and Scikit-Learn
-- Code Examples
Package version checks
Add folder to path in order to load from the check_packages.py script:
Check recommended package versions:
Chapter 12: Parallelizing Neural Network Training with PyTorch (Part 1/2)
Note that the optional watermark extension is a small IPython notebook plugin that I developed to make the code reproducible. You can just skip the following line(s).
PyTorch and training performance
Performance challenges
What is PyTorch?
How we will learn PyTorch
First steps with PyTorch
Installing PyTorch
Creating tensors in PyTorch
Manipulating the data type and shape of a tensor
Applying mathematical operations to tensors
Split, stack, and concatenate tensors
Building input pipelines in PyTorch
Creating a PyTorch DataLoader from existing tensors
Combining two tensors into a joint dataset
Shuffle, batch, and repeat
Creating a dataset from files on your local storage disk
Fetching available datasets from the torchvision.datasets library
Fetching CelebA dataset
Downloading the image files manually
You can try setting
download=True
below. If this results in aBadZipfile
error, we recommend downloading theimg_align_celeba.zip
file manually from http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html. In the Google Drive folder, you can find it under theImg
folder as shown below:
You can also try this direct link: https://drive.google.com/file/d/0B7EVK8r0v71pZjFTYXZWM3FlRnM/view?usp=sharing&resourcekey=0-dYn9z10tMJOBAkviAcfdyQ
After downloading, please put this file into the
./celeba
subolder and unzip it.
Next, you need to download the annotation files and put them into the same
./celeba
subfolder. The annotation files can be found underAnno
:
direct links are provided below:
Lastly, you need to download the file
list_eval_partition.txt
and place it under./celeba
:
After completing steps 1-3 above, please ensure you have the following files in your ./celeba
subfolder, and the files are non-empty (that is, they have similar file sizes as shown below):
Readers may ignore the next cell.