sampling via pymc raises TypeError since pymc v5.20.1
see #1390 for details.
To fix this issue, we should check whether pymc made a new release and fixed the problem and then remove the fail mark from the tests here
https://github.com/sbi-dev/sbi/blob/4c1ffa256f530ae09a330078a188e1dfa0b5603e/tests/mcmc_test.py#L188-L196
and here
https://github.com/sbi-dev/sbi/blob/4c1ffa256f530ae09a330078a188e1dfa0b5603e/tests/posterior_sampler_test.py#L30-L36
Hi @janfb @gmoss13,
I hope you're doing well!
I’d like to take on this issue. From what I understand, the solution would involve checking if a new version of PyMC has been released that fixes the TypeError issue introduced in version 5.20.1. If there is a new release, I would then remove the xfail marks from the tests in sbi/tests/mcmc_test.py and sbi/tests/posterior_sampler_test.py.
Could you please assign this issue to me?
Thank You !
Hi @Muhammad-Rebaal
thanks for offering to take on this issue. Yes, your plan looks good. Maybe this has been raised as an issue in pymc already.
If not, we should find out what exactly causes the error. Maybe there is a workaround for use until pymc has a fix. Maybe this problem is actually caused on our end and we can fix it. If not, we should create an issue in pymc.
Let me know if you have any questions!
Hi @janfb, since Muhammad didn’t raise a PR, I will go ahead and try to resolve this issue—if that’s okay with you. He was assigned to it back in March, and now it’s already November.
yeah, sounds good! Please check our contribution guide for how to get started contributing. Let me know if you need any input. Thanks! 🙏
@janfb The new release of pymc has not been made that solves this issue and there are no any mentioned issue that points to this, when i searched in issue tracker of pymc . I think the workaround is to constrain the pymc version to 5.20.0 not sure if there are other options for it . Can you please suggest me what shall i do next ?
Great to get this started!
A couple of questions:
- Where you able to reproduce the issue with the current
sbirelease,0.25, by running the test without thefailmark? - Does the error message still occur if you manually install the most recent pymc?
Yes, the issue still persists with the current sbi release (v0.25). I ran the test without the @pytest.mark.xfail decorator and reproduced the error. Additionally, manually installing the latest version of pymc does not resolve it — the same error message continues to appear.
I see, thanks for checking!
and pinning the version to "pymc>=5.0.0, <5.20" resolves the problem?
Yes, pinning the version to "pymc>=5.0.0, <5.20" resolves the problem. -Working Range: The test works correctly on versions of PyMC less than 5.20 and also on 5.20.0.
-Failure Point: The failure starts at 5.20.1 (and continues in later versions), showing the TypeError: unsupported format string in the progress bar.
Good, then we have a solution for now.
The tests already have a conditional flag for the 5.21 version, right? We can just keep that.
So, the only change would be in the dependencies, updating the pyproject.toml.
Would you be up for making that small PR?
Yes , sure . I will be creating the PR as soon as i update pyproject.toml.