From 33c57665c73d69d4f506a5010441f8f23922a1e4 Mon Sep 17 00:00:00 2001 From: Jonathan Dekermanjian Date: Sun, 8 Sep 2024 11:42:59 -0600 Subject: [PATCH] moved gaussian process checking from clone_model to lower level fgraph_from_model --- pymc/model/fgraph.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pymc/model/fgraph.py b/pymc/model/fgraph.py index b61ff06da3..400ee728f5 100644 --- a/pymc/model/fgraph.py +++ b/pymc/model/fgraph.py @@ -160,6 +160,12 @@ def fgraph_from_model( "Nested sub-models cannot be converted to fgraph. Convert the parent model instead" ) + check_for_gp_vars = [ + k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k + ] + if len(check_for_gp_vars) > 0: + warnings.warn("Unable to clone Gaussian Process Variables", UserWarning) + # Collect PyTensor variables rvs_to_values = model.rvs_to_values rvs = list(rvs_to_values.keys()) @@ -393,11 +399,6 @@ def clone_model(model: Model) -> Model: z = pm.Deterministic("z", clone_x + 1) """ - check_for_gp_vars = [ - k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k - ] - if len(check_for_gp_vars) > 0: - warnings.warn("Unable to clone Gaussian Process Variables", UserWarning) return model_from_fgraph(fgraph_from_model(model)[0], mutate_fgraph=True)