diff --git a/numpyro/primitives.py b/numpyro/primitives.py index 1898fcf69..f37571aac 100644 --- a/numpyro/primitives.py +++ b/numpyro/primitives.py @@ -181,10 +181,11 @@ def sample( ) if not isinstance(fn, numpyro.distributions.Distribution): type_error = TypeError( - "It looks like you tried to use a fn that isn't an instance of " + "Invalid type for 'fn': expected an instance of " "numpyro.distributions.Distribution, funsor.Funsor or " - "tensorflow_probability.distributions.Distribution. If you're using " - "funsor or tensorflow_probability, make sure they are correctly installed." + "tensorflow_probability.distributions.Distribution, " + f"but received {type(fn).__name__}. If you're using funsor or " + "tensorflow_probability, make sure they are correctly installed." ) # fn can be a funsor.Funsor, but this won't be installed for all users