From dbe9e9d2c6420a841076105bbad0a86b4e6eca7f Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sun, 27 Nov 2022 07:04:25 +1300 Subject: [PATCH] Fix list_models bug --- ldm/invoke/model_cache.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ldm/invoke/model_cache.py b/ldm/invoke/model_cache.py index 3bb1b7e928a..6d4e592e447 100644 --- a/ldm/invoke/model_cache.py +++ b/ldm/invoke/model_cache.py @@ -134,12 +134,14 @@ def list_models(self) -> dict: } ''' models = {} - for name, config in self.config.items(): + for config_entry in self.config.items(): + (name, config) = config_entry + try: description = config.description except ConfigAttributeError: description = '' - + if self.current_model == name: status = 'active' elif name in self.models: @@ -147,12 +149,9 @@ def list_models(self) -> dict: else: status = 'not loaded' - models = models.update( - name = { - 'status': status, - 'description': description, - }) - + model_details = {name: {'status': status, 'description': description,}} + models.update(model_details) + return models def print_models(self) -> None: