From 472da97098d5f42fdbe5267704af43b07b20ebd1 Mon Sep 17 00:00:00 2001 From: Adarsh Dubey <84132532+inclinedadarsh@users.noreply.github.com> Date: Mon, 27 Jan 2025 00:12:59 +0530 Subject: [PATCH] fix: deep copy nuts_sampler_kwarg to prevent `.pop` side effects (#7652) --- pymc/sampling/mcmc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pymc/sampling/mcmc.py b/pymc/sampling/mcmc.py index 6fb80284fd..4d7b9ff15a 100644 --- a/pymc/sampling/mcmc.py +++ b/pymc/sampling/mcmc.py @@ -338,6 +338,7 @@ def _sample_external_nuts( UserWarning, ) compile_kwargs = {} + nuts_sampler_kwargs = nuts_sampler_kwargs.copy() for kwarg in ("backend", "gradient_backend"): if kwarg in nuts_sampler_kwargs: compile_kwargs[kwarg] = nuts_sampler_kwargs.pop(kwarg)