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

torch demands too much GPU memory #1

Open
joshuajaistein opened this issue May 22, 2023 · 1 comment
Open

torch demands too much GPU memory #1

joshuajaistein opened this issue May 22, 2023 · 1 comment

Comments

@joshuajaistein
Copy link

I am using a 2080 super GPU and after the training loop I end up with this error

Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.

Fair enough, If I follow the error and introduce .backward(retain_graph = True),

CUDA just demands for enormous memory like

CUDA out of memory. Tried to allocate 133.05 GiB (GPU 0; 7.79 GiB total capacity; 444.44 MiB already allocated; 5.24 GiB free; 612.00 MiB reserved in total by PyTorch)(Edited)

Could you share any possible fix ?

@zhyblue424
Copy link

I am using a 2080 super GPU and after the training loop I end up with this error

Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.

Fair enough, If I follow the error and introduce .backward(retain_graph = True),

CUDA just demands for enormous memory like

CUDA out of memory. Tried to allocate 133.05 GiB (GPU 0; 7.79 GiB total capacity; 444.44 MiB already allocated; 5.24 GiB free; 612.00 MiB reserved in total by PyTorch)(Edited)

Could you share any possible fix ?

Hello, I also encountered this problem, may I ask you to solve it?

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