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

Add Minipyro Example #8

Merged
merged 6 commits into from
Jul 2, 2024
Merged

Add Minipyro Example #8

merged 6 commits into from
Jul 2, 2024

Conversation

rvs314
Copy link
Contributor

@rvs314 rvs314 commented Jul 1, 2024

This re-implements the minipyro example from pyro on top of the effectful library. The pyro-api tests for the parts we've implemented are all passing.

@rvs314 rvs314 requested a review from eb8680 July 1, 2024 18:47
@rvs314
Copy link
Contributor Author

rvs314 commented Jul 1, 2024

This should close #2

@rvs314 rvs314 force-pushed the minipyro-example branch from cf96b00 to 941bcfb Compare July 1, 2024 19:02
Copy link
Contributor

@eb8680 eb8680 left a comment

Choose a reason for hiding this comment

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

Looks great! I requested several mostly cosmetic changes below which are somewhat in the weeds, but which I think are worth addressing to make this example more effective as documentation for the library.

We can meet tomorrow and go through the more substantive design issues in the library that this exercise has uncovered.

effectful/ops/pyro.py Outdated Show resolved Hide resolved
effectful/ops/pyro.py Outdated Show resolved Hide resolved
effectful/ops/pyro.py Outdated Show resolved Hide resolved
effectful/ops/pyro.py Outdated Show resolved Hide resolved
effectful/ops/pyro.py Outdated Show resolved Hide resolved
tests/test_pyro.py Outdated Show resolved Hide resolved
effectful/ops/handler.py Outdated Show resolved Hide resolved
effectful/ops/pyro.py Outdated Show resolved Hide resolved
try:
item.runtest()
except NotImplementedError as e:
pytest.xfail(str(e))
Copy link
Contributor

Choose a reason for hiding this comment

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

Which tests imported from pyroapi fail without this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • tests which use the jit
  • tests which use clipped ADAM
  • tests which use TraceMeanField_ELBO
  • Tests which use the event_dim arg of plate

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, can we make this more specific so that it only xfails the failing minipyro tests? Otherwise this will apply to all current and future tests in effectful.

Copy link
Contributor Author

@rvs314 rvs314 Jul 2, 2024

Choose a reason for hiding this comment

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

Unfortunately, the pyro-api package is the one that raises the exceptions (which are just NotImplementedErrors), not us, so it's difficult to track the cause of each issue. I can do a check based on substrings which works for now, but it's a bit of a hack.

Copy link
Contributor

Choose a reason for hiding this comment

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

A check based on substrings is OK for now. You might also be able to restrict this to only apply to tests in test_minipyro.py, so that it doesn't inadvertently xfail tests in other parts of the library.

tests/test_pyro.py Outdated Show resolved Hide resolved
@eb8680 eb8680 added documentation Improvements or additions to documentation status:awaiting response labels Jul 1, 2024
@eb8680
Copy link
Contributor

eb8680 commented Jul 2, 2024

Can you run make format and fix the test failures in CI? It's OK if type checking fails for now, but all of the unit tests (except the xfailing pyroapi tests) should pass.

@eb8680 eb8680 added blocked and removed blocked labels Jul 2, 2024
@eb8680 eb8680 merged commit 9dc44db into master Jul 2, 2024
1 of 7 checks passed
@eb8680 eb8680 deleted the minipyro-example branch July 2, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation example status:awaiting response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants