How do the example code utilize the GPU?

#16
by aliakyurek - opened

How do the example code utilize the GPU?
Because I don't see a code like pipe = pipe.to("cuda")

We use cpu offloading here so that the code can run on less than 10GB GPUs.

Different components will automatically loaded to GPU and offloaded from via the line:

pipe.enable_model_cpu_offload()

Therefore we don't need to do a .to("cuda") call.

For more information, you can check:
https://huggingface.co/docs/diffusers/v0.19.3/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.enable_model_cpu_offload

Hope that this helps!

patrickvonplaten changed discussion status to closed

Sign up or log in to comment