From a341297b0c5b12046e21bf11ff6edc7832105bf9 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sat, 26 Nov 2022 14:58:22 +0000 Subject: [PATCH] stop crash on !import_models call on model inside rootdir - addresses bug report #1546 --- ldm/invoke/model_cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ldm/invoke/model_cache.py b/ldm/invoke/model_cache.py index 645a6fd4da..d14c59f39a 100644 --- a/ldm/invoke/model_cache.py +++ b/ldm/invoke/model_cache.py @@ -178,11 +178,12 @@ class ModelCache(object): method will return True. Will fail with an assertion error if provided attributes are incorrect or the model name is missing. ''' + omega = self.config + for field in ('description','weights','height','width','config'): assert field in model_attributes, f'required field {field} is missing' assert (clobber or model_name not in omega), f'attempt to overwrite existing model definition "{model_name}"' - omega = self.config config = omega[model_name] if model_name in omega else {} for field in model_attributes: config[field] = model_attributes[field]