From 84d3a7f6f5b56264f8ae5737e21c15ea78b4b6bc Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Thu, 3 Aug 2023 17:50:10 -0700 Subject: [PATCH] fix fallback logic for config path --- sgm/inference/api.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sgm/inference/api.py b/sgm/inference/api.py index 285fe9e..a320500 100644 --- a/sgm/inference/api.py +++ b/sgm/inference/api.py @@ -182,15 +182,12 @@ class SamplingPipeline: config_path = ( pathlib.Path(__file__).parent.parent.resolve() / "configs/inference" ) + if not os.path.exists(config_path): + # This supports development installs where configs is root level of the repo + config_path = pathlib.Path(__file__).parent.parent.parent.resolve() / "configs/inference" self.config = str(config_path / self.specs.config) self.ckpt = str(model_path / self.specs.ckpt) if not os.path.exists(self.config): - # This supports development installs where configs is root level of the repo - if config_path is None: - config_path = ( - pathlib.Path(__file__).parent.parent.parent.resolve() - / "configs/inference" - ) raise ValueError( f"Config {self.config} not found, check model spec or config_path" )