diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

For some modules using GPU/CPU setup issues

Open Night-Quiet opened this issue 3 years ago • 1 comments

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"))

Night-Quiet avatar Dec 15 '22 06:12 Night-Quiet

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

patrickvonplaten avatar Dec 19 '22 17:12 patrickvonplaten

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

Thanks for the reply, indeed, updating diffusers solved the problem

Night-Quiet avatar Dec 30 '22 03:12 Night-Quiet

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.

github-actions[bot] avatar Jan 23 '23 15:01 github-actions[bot]