I guess for some reason none of the passed parameters have a valid gradient, which will thus break the code. This was a known issue in PyTorch 1.8.0 after a refactoring of the optimizers, which was then fixed in this PR 52 and should be available in 1.8.1 as well as the nightly binaries.
To fix it you could thus update PyTorch or make sure that some of the parameters have a gradient.