fix: 2.1 models breaking generation

Co-Authored-By: StAlKeR7779 <7768370+StAlKeR7779@users.noreply.github.com>
This commit is contained in:
blessedcoolant 2023-06-18 08:26:25 +12:00 committed by psychedelicious
parent d2f3500e1b
commit 727293d722

View File

@ -94,6 +94,11 @@ class ModelBase(metaclass=ABCMeta):
def _hf_definition_to_type(self, subtypes: List[str]) -> Type: def _hf_definition_to_type(self, subtypes: List[str]) -> Type:
if len(subtypes) < 2: if len(subtypes) < 2:
raise Exception("Invalid subfolder definition!") raise Exception("Invalid subfolder definition!")
if all(t is None for t in subtypes):
return None
elif any(t is None for t in subtypes):
raise Exception(f"Unsupported definition: {subtypes}")
if subtypes[0] in ["diffusers", "transformers"]: if subtypes[0] in ["diffusers", "transformers"]:
res_type = sys.modules[subtypes[0]] res_type = sys.modules[subtypes[0]]
subtypes = subtypes[1:] subtypes = subtypes[1:]