I just used the conda package for the nightly build:
conda install pytorch cudatoolkit=10.1 -c pytorch-nightly -c defaults -c conda-forge

Could you try to install it and rerun the code?
Let me know, if you are still running into this issue and I’ll try to run the code for more epochs.