Skip to content

Conversation

@OlaRonning
Copy link
Member

@OlaRonning OlaRonning commented Mar 9, 2025

ASVGD had a memory leak caused by assigning a JAX Tracer to an attribute. This PR resolves the issue by introducing a state tuple that is passed along with the optimization process instead.

Changes:

  1. Introduced ASVGDState to track the annealing state in ASVGD.
  2. Extended SteinVIState to include temperature tracking.

TODO

Related to #1982

…perature and repulsion_temperature to the SteinVIState; renamed _svgd_loss_and_grads => _loss_and_grads; added loss and repulsion temperature to signature of _loss_and_grads
@OlaRonning OlaRonning added the WIP label Mar 9, 2025
@pytest.mark.xfail(
os.getenv("JAX_CHECK_TRACER_LEAKS") == "1", reason="Expected tracer leak"
)
def test_run_smoke(kernel, problem, method):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fehiepsi do I remove the mark.xfail decorator?

@pytest.mark.xfail(
    os.getenv("JAX_CHECK_TRACER_LEAKS") == "1", reason="Expected tracer leak"
)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to follow this and remove it.
Running

JAX_CHECK_TRACER_LEAKS=1 pytest -vs test/contrib/einstein/test_steinvi.py

passes now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OlaRonning OlaRonning removed the WIP label Mar 9, 2025
@OlaRonning OlaRonning requested a review from fehiepsi March 9, 2025 16:18
Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, Ola!

@OlaRonning OlaRonning merged commit 374cd89 into pyro-ppl:master Mar 9, 2025
10 checks passed
@OlaRonning OlaRonning deleted the bug/asvgd_memleak branch March 9, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants