Funsor problems when using hmm example in numpyro

I created a simplified version. of the simple discrete HMM numpyro example for Bach chorales, and put it in this colab. However, when i run it, I get the error module 'funsor' has no attribute 'interpretations'. Full stack trace below.

INFO:__main__:Starting inference...
---------------------------------------------------------------------------
UnfilteredStackTrace                      Traceback (most recent call last)
<ipython-input-16-f7707504f100> in <module>()
     15 nstates = 5
---> 16 mcmc.run(rng_key, sequences, lengths, hidden_dim=nstates)
     17 mcmc.print_summary()

57 frames
UnfilteredStackTrace: AttributeError: module 'funsor' has no attribute 'interpretations'

The stack trace below excludes JAX-internal frames.
The preceding is the original exception that occurred, unmodified.

--------------------

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/numpyro/contrib/funsor/infer_util.py in compute_markov_factors(time_to_factors, time_to_init_vars, time_to_markov_dims, sum_vars, prod_vars, history, sum_op, prod_op)
    120         # we eliminate all plate and enum dimensions not available at markov sites.
    121         eliminate_vars = (sum_vars | prod_vars) - time_to_markov_dims[time_var]
--> 122         with funsor.interpretations.lazy:
    123             lazy_result = funsor.sum_product.sum_product(
    124                 sum_op,

AttributeError: module 'funsor' has no attribute 'interpretations'

Hi @murphyk, could you try to install the master branch of funsor? FYI, we will make a new release for both numpyro and funsor soon. In the future, we will try to have more patch releases. :slight_smile:

I tried !git clone https://github.com/pyro-ppl/funsor.git instead of !pip install funsor in my colab. Is that what you meant? Anyways, no I get a different error:

AttributeError: module 'funsor' has no attribute 'set_backend'

I think what you need is pip install -q git+https://... (similar to how you install numpyro in colab) rather than git clone

This is helpful, thanks for sharing.