Get the image and the gradient at the same time #8940
-
I am new to stable diffusion. I am trying to train a llm with stable diffusion, my loss need the output image to calculate. At first I use the pipeline to generate the image, but I found that there is no gradient, then I found that example file in this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
In the pipelines, there is a decorator |
Beta Was this translation helpful? Give feedback.
In the pipelines, there is a decorator
torch
method on top of their__call__
and several other methods. It avoids preserving gradients while inferencing. Could you examine the examples in these docs pages? In these examples, you can run the overall pipeline by separating its components and eliminating the aforementionedtorch
method in order to preserve gradients.