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

Use of dict.pop in pm.sample leads to side effects #7632

Open
jessegrabowski opened this issue Jan 6, 2025 · 0 comments
Open

Use of dict.pop in pm.sample leads to side effects #7632

jessegrabowski opened this issue Jan 6, 2025 · 0 comments

Comments

@jessegrabowski
Copy link
Member

jessegrabowski commented Jan 6, 2025

Description

I commonly create a sample_kwargs variable in notebooks and re-use it in multiple models. Such a dictionary ends up being modified in-place by pm.sample when entries are popped, for example here and here, leading to models beyond the first silently using defaults settings.

I guess the easiest fix would just be to deepcopy kwargs, so that there are no side effects on user inputs. Using pop here is a bit overkill (why not just ,get?) but deepcopy is a 1-line change.

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

1 participant