Could you try to move these two lines 8 right after the args = parser.parse_args() call?
I needed to move them as I got an error as:
RuntimeError: context has already been set

I’ll create an issue with a fix if I can reproduce it using the nightly (my current PyTorch build is a source build from a few weeks ago).