mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
revert to older version of list_models() (#1611)
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()
This commit is contained in:
parent
8999a5564b
commit
40c3ab0181
@ -126,18 +126,15 @@ class ModelCache(object):
|
|||||||
def list_models(self) -> dict:
|
def list_models(self) -> dict:
|
||||||
'''
|
'''
|
||||||
Return a dict of models in the format:
|
Return a dict of models in the format:
|
||||||
{
|
{ model_name1: {'status': ('active'|'cached'|'not loaded'),
|
||||||
model_name1: {
|
|
||||||
'status': ('active'|'cached'|'not loaded'),
|
|
||||||
'description': description,
|
'description': description,
|
||||||
},
|
},
|
||||||
model_name2: { etc },
|
model_name2: { etc }
|
||||||
}
|
|
||||||
'''
|
'''
|
||||||
models = {}
|
models = {}
|
||||||
for name, config in self.config.items():
|
for name in self.config:
|
||||||
try:
|
try:
|
||||||
description = config.description
|
description = self.config[name].description
|
||||||
except ConfigAttributeError:
|
except ConfigAttributeError:
|
||||||
description = '<no description>'
|
description = '<no description>'
|
||||||
|
|
||||||
@ -148,12 +145,10 @@ class ModelCache(object):
|
|||||||
else:
|
else:
|
||||||
status = 'not loaded'
|
status = 'not loaded'
|
||||||
|
|
||||||
models.update(
|
models[name]={
|
||||||
name = {
|
|
||||||
'status' : status,
|
'status' : status,
|
||||||
'description': description,
|
'description' : description
|
||||||
})
|
}
|
||||||
|
|
||||||
return models
|
return models
|
||||||
|
|
||||||
def print_models(self) -> None:
|
def print_models(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user