Memory leak using TraceEnum_ELBO
See original GitHub issueI noticed a major memory leak when training SVI using TraceEnum_ELBO
.
I initially noticed this in a custom model we are developing but then I found it seems a more general bug.
For example, it affects even the Pyro tutorials GMM example here. Where memory usage rapidly goes from a couple of hundred MBs to a many GBs very quickly!
I have run this Macbook Pro 2019 running MacOS 10.15. To replicate the issue is enough running the notebook linked.
I have tried to comment out the following lines and add a garbage collector call, that reduces the entity of the memory accumulation of one order of magnitude but does not solve the problem completely, which becomes particularly severe for large datasets.
# Register hooks to monitor gradient norms.
# gradient_norms = defaultdict(list)
# for name, value in pyro.get_param_store().named_parameters():
# value.register_hook(lambda g, name=name: gradient_norms[name].append(g.norm().item()))
import gc
losses = []
for i in range(200000):
loss = svi.step(data)
#losses.append(loss)
gc.collect()
(from this forum post)
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Finding and Fixing Memory Leaks in Python - BuzzFeed Tech
Reading bottom to top, this shows a trace to a line in the socket module where a memory allocation took place. With this...
Read more >Identifying Memory Leaks Through Tracing - Percepio
The first method to detect a memory leak is to use the Tracealyzer Memory Heap Utilization view. This view can be accessed by...
Read more >Finding memory leaks using Timing Captures - PIX on Windows
PIX Timing Captures include several analysis features aimed at making it easy to find memory leaks in your title.
Read more >Determine the cause of a memory leak using LeanSentry's ...
In part 2, we'll explore how to use the LeanSentry Memory diagnostics report to determine the cause of a .NET memory leak.
Read more >Understanding Memory Leaks in Java - Baeldung
A Memory Leak is a situation where there are objects present in the heap that are no longer used, but the garbage collector...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Downgrading, as @qinqian suggests, also resolves #3014.
I have noticed a GPU memory leaks too with Pyro 1.8.1+06911dc and PyTorch 1.11.0. Downgrade to Pyro 1.6.0 and PyTorch 1.8.0 works normally.