From e13c4c3cc296d9b9cd267848438a1b52edc3223c Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 29 Nov 2022 04:36:11 +0000 Subject: [PATCH] revert to older version of list_models() This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() --- ldm/invoke/model_cache.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/ldm/invoke/model_cache.py b/ldm/invoke/model_cache.py index 82f46340bb4..7d1654718a3 100644 --- a/ldm/invoke/model_cache.py +++ b/ldm/invoke/model_cache.py @@ -126,18 +126,15 @@ def set_default_model(self,model_name:str) -> None: def list_models(self) -> dict: ''' Return a dict of models in the format: - { - model_name1: { - 'status': ('active'|'cached'|'not loaded'), - 'description': description, - }, - model_name2: { etc }, - } + { model_name1: {'status': ('active'|'cached'|'not loaded'), + 'description': description, + }, + model_name2: { etc } ''' models = {} - for name, config in self.config.items(): + for name in self.config: try: - description = config.description + description = self.config[name].description except ConfigAttributeError: description = '' @@ -148,12 +145,10 @@ def list_models(self) -> dict: else: status = 'not loaded' - models.update( - name = { - 'status': status, - 'description': description, - }) - + models[name]={ + 'status' : status, + 'description' : description + } return models def print_models(self) -> None: