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

How much GPU memory to run inference.py? #17

Closed
boringtaskai opened this issue Jan 2, 2024 · 5 comments
Closed

How much GPU memory to run inference.py? #17

boringtaskai opened this issue Jan 2, 2024 · 5 comments

Comments

@boringtaskai
Copy link

boringtaskai commented Jan 2, 2024

I tried to run inference, but failed 'CUDA out of memory', I'm using 8GB RTX 3080 TI, does it work?

@yhyu13
Copy link

yhyu13 commented Jan 2, 2024

24GB vram was suggested

Edit:
Just finish a run on inference.py which peak at 20.6GB VRAM

@boringtaskai
Copy link
Author

So there is no difference between inference.py and demo.py for GPU memory requirement?

How to resize batch_size so it can run on the small amount of GPU memory, the tradeoff is a little bit longer to process?
(I cannot find the batch_size configuration in the anytext_sd15.yaml)

@tyxsspa
Copy link
Owner

tyxsspa commented Jan 3, 2024

So there is no difference between inference.py and demo.py for GPU memory requirement?

How to resize batch_size so it can run on the small amount of GPU memory, the tradeoff is a little bit longer to process? (I cannot find the batch_size configuration in the anytext_sd15.yaml)

Hi,
in inference.py, you can reduce image_count in params:

params = {
    "show_debug": True,
    "image_count": 2,    # <---- batch size
    "ddim_steps": 20,
}

in demo.py, the Image Count is in Parameters.

BTW, I am trying FP16 inference and it seems to have little difference in performance. It is possible that the GPU memory requirement can be reduced to below 10GB. I will push the updated code later.

@boringtaskai
Copy link
Author

So there is no difference between inference.py and demo.py for GPU memory requirement?
How to resize batch_size so it can run on the small amount of GPU memory, the tradeoff is a little bit longer to process? (I cannot find the batch_size configuration in the anytext_sd15.yaml)

Hi, in inference.py, you can reduce image_count in params:

params = {
    "show_debug": True,
    "image_count": 2,    # <---- batch size
    "ddim_steps": 20,
}

in demo.py, the Image Count is in Parameters.

BTW, I am trying FP16 inference and it seems to have little difference in performance. It is possible that the GPU memory requirement can be reduced to below 10GB. I will push the updated code later.

Cool I cannot wait to see the update 😉

@boringtaskai
Copy link
Author

Thank you @tyxsspa , I fetch the FP16 commit, and now I success to run demo.py on my 8GB GPU. 🥰🙏

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

3 participants