From d02dc1abe8e796ab5f17325d3bb1e10915f74651 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sat, 26 Nov 2022 12:57:47 -0500 Subject: [PATCH] Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. --- ldm/invoke/model_cache.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/ldm/invoke/model_cache.py b/ldm/invoke/model_cache.py index 3bb1b7e928a..645a6fd4da1 100644 --- a/ldm/invoke/model_cache.py +++ b/ldm/invoke/model_cache.py @@ -125,18 +125,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(): + result = dict() + for name in self.config: try: - description = config.description + description = self.config[name].description except ConfigAttributeError: description = '' @@ -147,13 +144,11 @@ def list_models(self) -> dict: else: status = 'not loaded' - models = models.update( - name = { - 'status': status, - 'description': description, - }) - - return models + result[name]={ + 'status' : status, + 'description' : description + } + return result def print_models(self) -> None: '''