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

Pyro version 1.9.1 causes tests to fail #122

Open
ellieyhcheng opened this issue Jun 7, 2024 · 1 comment
Open

Pyro version 1.9.1 causes tests to fail #122

ellieyhcheng opened this issue Jun 7, 2024 · 1 comment

Comments

@ellieyhcheng
Copy link

Pyro version 1.9.1 causes tests in tests/test_inference.py to fail when loading guides.

======================================================================== FAILURES =========================================================================
_____________________________________ test_smoke_CausalInsigth[1-industry_real_estate_total-spending_transportation] ______________________________________

intervention = 'spending_transportation', outcome = 'industry_real_estate_total', shift = 1

    @pytest.mark.parametrize("intervention", interventions)
    @pytest.mark.parametrize("outcome", outcomes)
    @pytest.mark.parametrize("shift", shifts)
    def test_smoke_CausalInsigth(intervention, outcome, shift):
        ci = CausalInsight(
            outcome_dataset=outcome,
            intervention_dataset=intervention,
            num_samples=5,
        )
    
>       ci.load_guide(forward_shift=2)

/Users/Admin/Documents/cities/tests/test_inference.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Admin/Documents/cities/cities/queries/causal_insight.py:99: in load_guide
    self.guide = dill.load(file)
/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:289: in load
    return Unpickler(file, ignore=ignore, **kwds).load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dill._dill.Unpickler object at 0x177a33a80>

    def load(self): #NOTE: if settings change, need to update attributes
>       obj = StockUnpickler.load(self)
E       AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?

/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:444: AttributeError
_____________________________________ test_smoke_CausalInsigth[2-industry_real_estate_total-spending_transportation] ______________________________________

intervention = 'spending_transportation', outcome = 'industry_real_estate_total', shift = 2

    @pytest.mark.parametrize("intervention", interventions)
    @pytest.mark.parametrize("outcome", outcomes)
    @pytest.mark.parametrize("shift", shifts)
    def test_smoke_CausalInsigth(intervention, outcome, shift):
        ci = CausalInsight(
            outcome_dataset=outcome,
            intervention_dataset=intervention,
            num_samples=5,
        )
    
>       ci.load_guide(forward_shift=2)

/Users/Admin/Documents/cities/tests/test_inference.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Admin/Documents/cities/cities/queries/causal_insight.py:99: in load_guide
    self.guide = dill.load(file)
/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:289: in load
    return Unpickler(file, ignore=ignore, **kwds).load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dill._dill.Unpickler object at 0x177a33bb0>

    def load(self): #NOTE: if settings change, need to update attributes
>       obj = StockUnpickler.load(self)
E       AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?

/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:444: AttributeError
_____________________________________ test_smoke_CausalInsigth[3-industry_real_estate_total-spending_transportation] ______________________________________

intervention = 'spending_transportation', outcome = 'industry_real_estate_total', shift = 3

    @pytest.mark.parametrize("intervention", interventions)
    @pytest.mark.parametrize("outcome", outcomes)
    @pytest.mark.parametrize("shift", shifts)
    def test_smoke_CausalInsigth(intervention, outcome, shift):
        ci = CausalInsight(
            outcome_dataset=outcome,
            intervention_dataset=intervention,
            num_samples=5,
        )
    
>       ci.load_guide(forward_shift=2)

/Users/Admin/Documents/cities/tests/test_inference.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Admin/Documents/cities/cities/queries/causal_insight.py:99: in load_guide
    self.guide = dill.load(file)
/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:289: in load
    return Unpickler(file, ignore=ignore, **kwds).load()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <dill._dill.Unpickler object at 0x177a33360>

    def load(self): #NOTE: if settings change, need to update attributes
>       obj = StockUnpickler.load(self)
E       AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?

/Users/Admin/Documents/cities/venv/lib/python3.12/site-packages/dill/_dill.py:444: AttributeError
================================================================= short test summary info =================================================================
FAILED tests/test_inference.py::test_smoke_CausalInsigth[1-industry_real_estate_total-spending_transportation] - AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?
FAILED tests/test_inference.py::test_smoke_CausalInsigth[2-industry_real_estate_total-spending_transportation] - AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?
FAILED tests/test_inference.py::test_smoke_CausalInsigth[3-industry_real_estate_total-spending_transportation] - AttributeError: 'CondIndepStackFrame' object has no attribute '__dict__'. Did you mean: '__dir__'?

Installing pyro-ppl==1.8.5 resolves the test failures.

@rfl-urbaniak
Copy link
Contributor

Yes. I was just about to post this issue myself, thanks! For now, let's still use 1.8.5. Meanwhile, we're building more general models while testing them with pyro-ppl==1.9.1, of which the existing ones should be a particular case. If this works out, both the model and this test will be replaced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants