I think the error is raised, if you are calling the step() function on optimizers which contain (a subset of) the same parameters as explained in the release notes for 1.5.0 30.
Could this be the case and if so, could you move the step() calls to the end of the iteration?