For some modules using GPU/CPU setup issues
What API design would you like to have changed or added to the library? Why?
API: UNet2DConditionModel
Reason: When I use this module for a simple initialization, it tries to use the GPU, which uses about 699m of memory, for example: unet = UNet2DConditionModel.from_config(unet_config). I just need an initialized unet, and I want to be able to control it to do in the CPU. Thank you.
Environment: Ubuntu: 20.04 GPU: NVIDIA A40 diffusers: 0.9.0 transformers: 4.25.1
P.S. If you use "unet.device" to check it, it will show "cpu", but it's still using 699m GPU memory.
What use case would this enable or better enable? Can you give us a code example?
unet = UNet2DConditionModel.from_config(unet_config, device=torch.device("cpu")) or unet = UNet2DConditionModel(**unet_config, device=torch.device("cpu"))
Hey @Night-Quiet,
Could you please add a reproducible code snippet? Also on the newest version, no GPU memory should be allocated anymore at all :-)
Could you try updating diffusers to 0.10.2 and try again?
pip install --upgrade diffusers
Hey @Night-Quiet,
Could you please add a reproducible code snippet? Also on the newest version, no GPU memory should be allocated anymore at all :-)
Could you try updating
diffusersto0.10.2and try again?pip install --upgrade diffusers
Thanks for the reply, indeed, updating diffusers solved the problem
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.