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

Make Delta.log_prob jit-able on metal and raise explicit error for Delta sampling site during initialization. #1950

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

tillahoffmann
Copy link
Contributor

Two Delta distribution related changes.

  1. The current implementation uses jnp.log(value == self.v), where self.v is the value of the Delta distribution. This is not jit-able on metal (cf. lambda x: jnp.log(x == 1) is not jit-able on metal. jax-ml/jax#25935). The updated implementation uses jnp.where(value == self.v, 0, -jnp.inf) which is equivalent but jit-able.
  2. Delta sampling sites lead to a non-specific error message RuntimeError: Cannot find valid initial parameters. Please check your model again.. This change adds a line to check for unobserved Delta sites in a model and raises a more explicit error.

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, @tillahoffmann!

@fehiepsi fehiepsi merged commit 8a67269 into pyro-ppl:master Jan 17, 2025
10 checks passed
@tillahoffmann tillahoffmann deleted the delta-density branch January 18, 2025 16:30
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

Successfully merging this pull request may close these issues.

2 participants