proxy SDModelInfo so that it can be used directly as context

This commit is contained in:
Lincoln Stein 2023-05-13 16:29:18 -04:00
parent b23c9f1da5
commit d8b1f29066
2 changed files with 7 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class SDModelType(Enum):
# distinguish them by class
lora=LoraType
textual_inversion=TIType
class ModelStatus(Enum):
unknown='unknown'
not_loaded='not loaded'

View File

@ -176,6 +176,12 @@ class SDModelInfo():
revision: str = None
_cache: ModelCache = None
def __enter__(self):
return self.context.__enter__()
def __exit__(self,*args, **kwargs):
self.context.__exit__(*args, **kwargs)
@property
def status(self)->ModelStatus:
'''Return load status of this model as a model_cache.ModelStatus enum'''