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

HIP out of memory #134

Open
emircanerkul opened this issue Jan 15, 2025 · 6 comments
Open

HIP out of memory #134

emircanerkul opened this issue Jan 15, 2025 · 6 comments

Comments

@emircanerkul
Copy link

emircanerkul commented Jan 15, 2025

Using 6800xt 16gb linux 2.5.1+rocm6.1 but looks its not enough or i'm missing some configuration. I able to run 256x256 but 512x512 do not work. Any suggestions?

HIP out of memory. Tried to allocate 12.00 GiB. GPU 0 has a total capacity of 15.98 GiB of which 9.51 GiB is free. Of the allocated memory 5.85 GiB is allocated by PyTorch, and 270.37 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_HIP_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)```

@smthemex
Copy link
Owner

It seems to be an issue with VRM allocation, but I have not used any Rocm devices. Based on the information you provided, you can try to fix this line of code as:

 if not lowvram:
      torch.cuda.reset_max_memory_allocated(0)
      pipe.to("cuda", torch.float16)

@emircanerkul
Copy link
Author

@smthemex thank you for your quick respond.

I tried but it didn't worked. Also reboot the pc. I'm not sure if there are any code cache there

HIP out of memory. Tried to allocate 12.00 GiB. GPU 0 has a total capacity of 15.98 GiB of which 9.27 GiB is free. Of the allocated memory 6.17 GiB is allocated by PyTorch, and 176.96 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_HIP_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

If i increase 768 it require 60gb vram

HIP out of memory. Tried to allocate 60.75 GiB. GPU 0 has a total capacity of 15.98 GiB of which 6.91 GiB is free. Of the allocated memory 8.50 GiB is allocated by PyTorch, and 211.43 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_HIP_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

@smthemex
Copy link
Owner

Have you tested enabling low_vram

@emircanerkul
Copy link
Author

no because it is saying if not lowvram: So i did not used that --lowvram param.

Automatically it detect


Total VRAM 16368 MB, total RAM 15804 MB
pytorch version: 2.7.0.dev20250112+rocm6.3
Set vram state to: NORMAL_VRAM

@smthemex
Copy link
Owner

smthemex commented Jan 15, 2025

Low vram needs to be manually enabled at the node where the model is loaded. It will force the model to move to the CPU to avoid OOM
image
enable it and try
It's too late, I'm ready to go to bed. Regardless of whether the activation is effective or not, I will be able to reply to you in 10 hours

@emircanerkul
Copy link
Author

@smthemex okay thank you

With that option

HIP out of memory. Tried to allocate 12.00 GiB. GPU 0 has a total capacity of 15.98 GiB of which 1.65 GiB is free. Of the allocated memory 13.89 GiB is allocated by PyTorch, and 79.65 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_HIP_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

With 728 still require 60gb vram

HIP out of memory. Tried to allocate 60.75 GiB. GPU 0 has a total capacity of 15.98 GiB of which 11.65 GiB is free. Of the allocated memory 3.78 GiB is allocated by PyTorch, and 187.99 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_HIP_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

Also checked with _acc version, with without denoising, same.

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

2 participants