Skip to content

Commit

Permalink
Changed backend arg defaults to strings
Browse files Browse the repository at this point in the history
  • Loading branch information
fonnesbeck committed Oct 11, 2024
1 parent 8b9521c commit 29cd996
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/nutpie/compile_pymc.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ def expand(x, **shared):
def compile_pymc_model(
model: "pm.Model",
*,
backend: Literal["numba", "jax"] | None = None,
gradient_backend: Literal["pytensor", "jax"] | None = None,
backend: Literal["numba", "jax"] = "numba",
gradient_backend: Literal["pytensor", "jax"] = "pytensor",
**kwargs,
) -> CompiledModel:
"""Compile necessary functions for sampling a pymc model.
Expand Down Expand Up @@ -384,10 +384,9 @@ def compile_pymc_model(
"and restart your kernel in case you are in an interactive session."
)

if backend is None:
backend = "numba"

if backend.lower() == "numba":
if gradient_backend == "jax":
raise ValueError("Gradient backend cannot be jax when using numba backend")
return _compile_pymc_model_numba(model, **kwargs)
elif backend.lower() == "jax":
return _compile_pymc_model_jax(
Expand Down

0 comments on commit 29cd996

Please sign in to comment.