You’re correct, @Pomo.
If you’re using pip, this is just a straightforward:
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html
# replace cu100 with cu90 if you’re on cuda-9.0
With conda it’s tricky. Installing pytorch-nightly via conda would be a problem with fastai updates which relies on pytorch (different package name), so when you update fastai it may force to re-install pytorch (not nightly) and you would lose pytorch-nightly
There are 3 ways you can go about it:
-
use a dedicated conda environment for the part2 lessons, which requires no fastai
conda create -y python=3.7 --name fastai-part2
conda activate fastai-part2
conda install -y -c pytorch pytorch-nightly torchvision
i.e. don’t install fastai in that conda env.
-
install pytorch-nightly via pip into your normal fastai conda environment - conda won’t know that you did that and won’t overwrite it
conda install -c pytorch -c fastai fastai
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html
# replace cu100 with cu90 if you’re on cuda-9.0
-
always force reinstall pytorch-nightly after pytorch gets installed/updated in conda
conda install -c pytorch -c fastai fastai
conda install -c pytorch pytorch-nightly --force-reinstall
I updated the first post with this info. Let me know if you have difficulties with any of them.
And should we keep updating pytorch-nightly using:
conda install -c pytorch pytorch-nightly
You probably won’t need to update it again, pytorch-nightly was required in this lesson due to some pytorch bug that has been fixed recently, so chances are that whatever pytorch-nightly you installed a few days ago will be just fine for the rest of the course. And soon pytorch-1.1.0 will be released, so fastai will require that instead.
To see how the pytorch and pytorch-nightly packages overwrite each other:
conda uninstall pytorch pytorch-nightly torchvision
conda install -c pytorch pytorch torchvision
python -c 'import sys, torch; print(torch.__version__, sys.modules["torch"])'
1.0.1.post2 <module 'torch' from '.../site-packages/torch/__init__.py'>
and once we get pytorch-nightly, it overwrites pytorch, yet conda thinks they are 2 totally different packages.
conda install -c pytorch pytorch-nightly
python -c 'import sys, torch; print(torch.__version__, sys.modules["torch"])'
1.0.0.dev20190405 <module 'torch' from '.../site-packages/torch/__init__.py'>
I trimmed the output path so that it fits into the width, but the purpose is to show that it loads the exact same path in both cases.