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

any way to reduce UserWarning level on loading already loaded model? #219

Closed
bob-carpenter opened this issue Mar 22, 2024 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@bob-carpenter
Copy link
Collaborator

I'm calling Stan in a loop and getting this warning every iteration:

/usr/local/lib/python3.9/site-packages/bridgestan/model.py:137: UserWarning: Loading a shared object /Users/bcarpenter/github/bob-carpenter/adaptive-hmc/stan/normal_model.so that has already been loaded.
If the file has changed since the last time it was loaded, this load may not update the library!

This arises from calling this repeatedly in a loop with the same model_path:

   model = bs.StanModel(model_lib=model_path, data=data,
                             capture_stan_prints=False)

In this instance (and many others), I could pull the model creation out of the loop and pass it into the loop as an argument. I'd rather not have to do that here as it's more natural to have the caller not know anything about these low-level model-creation details.

@bob-carpenter bob-carpenter added the enhancement New feature or request label Mar 22, 2024
@roualdes
Copy link
Owner

Yep, Aki, just requested the same #217. Brian fixed it #218. Should be in the next release. Or you can pull the latest from GitHub and point your code to the local copy on your machine.

@WardBrian
Copy link
Collaborator

I don't like releasing on Fridays, otherwise I would get it out there for you now (it would be a small release, really just #218, #197, and #213 which would be user-facing)

@WardBrian
Copy link
Collaborator

If you run pip install --upgrade bridgestan now it will have the warn argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants