I had an old conda virtual environment with pytorch and cudatoolkit 10.1. I was able to run the code and I would always get the following message at the beginning: