Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cuda out of memory on RTX 24gb 3090 #150

Open
alext1995 opened this issue Aug 20, 2023 · 5 comments
Open

cuda out of memory on RTX 24gb 3090 #150

alext1995 opened this issue Aug 20, 2023 · 5 comments

Comments

@alext1995
Copy link

This is really interesting work! I tried to run it on a server with a 24gb 3090, and it runs into out of memory. Is a larger GPU needed? Please let me know what size GPU you are able to run it on.

Thanks

@EnochYe
Copy link

EnochYe commented Sep 21, 2023

I also encountered the same problem and look forward to the author’s reply.

@YyyxKun
Copy link

YyyxKun commented Sep 23, 2023

Same problem. Anbody can help?

@ChaeSeoyoung
Copy link

I encountered the same error and solved. In my opinion, 'CUDA out of memory' error can be solved by just adding some arguments.(e.g. --gradient_accumulation_steps=1 --gradient_checkpointing)
The below link might be help:
huggingface/diffusers#696

@xueqinxiang
Copy link

xueqinxiang commented Jul 13, 2024

I have tested my solution on A30 (24GB GPU only):

Step(1) Preparation: reduce the image size like (change the command):
python3 scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 8 --n_iter 1 --scale 10.0 --ddim_steps 50 --ckpt ./models/stablediffusion/sd-v1-4-full-ema.ckpt --prompt "a photo of a bird" --H 256 --W 256

Step(2) Training: disable DDP in main.py like:
---- # default to ddp
---- #trainer_config["accelerator"] = "ddp"

Then, the Average Peak memory about 21589.97MB
Note that, do not need to change the original command

Step(3) Generation: reduce the image size like (change the command):
python3 scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 8 --n_iter 1 --scale 10.0 --ddim_steps 100 --ckpt ./logs/round_bird2024-07-13T23-37-13_bird/checkpoints/epoch=000006.ckpt --prompt "photo of a sks bird" --H 256 --W 256

@ysw0530
Copy link

ysw0530 commented Sep 10, 2024

I have tested my solution on A30 (24GB GPU only):

Step(1) Preparation: reduce the image size like (change the command): python3 scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 8 --n_iter 1 --scale 10.0 --ddim_steps 50 --ckpt ./models/stablediffusion/sd-v1-4-full-ema.ckpt --prompt "a photo of a bird" --H 256 --W 256

Step(2) Training: disable DDP in main.py like: ---- # default to ddp ---- #trainer_config["accelerator"] = "ddp"

Then, the Average Peak memory about 21589.97MB Note that, do not need to change the original command

Step(3) Generation: reduce the image size like (change the command): python3 scripts/stable_txt2img.py --ddim_eta 0.0 --n_samples 8 --n_iter 1 --scale 10.0 --ddim_steps 100 --ckpt ./logs/round_bird2024-07-13T23-37-13_bird/checkpoints/epoch=000006.ckpt --prompt "photo of a sks bird" --H 256 --W 256

@xueqinxiang has the performance been affected ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants