You could try to set the .requires_grad of the parameters of the model, which should not get gradients, to False. This should still calculate the gradients for e.g. the generator, while no new gradients should be accumulated in the discriminator.
After this step, you would have to set these attribute to True again for the parameters.