I have set the variable and the model "requires_grad=true" with the following:
pipe.transformer.requires_grad = True pipe.vae.requires_grad = True
prev_sample = prev_sample.detach().requires_grad_(True)
but the "requires_grad" of result by the pipe is still not true:
image_tar = pipe.vae.decode(prev_sample, return_dict=False)[0]
"image_tar" still can not requires_grad, so how to set pipe "requires_grad=true"?(all the operation is during inference stage.)