Account for flat models

Merged models from auto11 merge board are flat for some reason. Current behavior of invoke is not changed by this modification.
This commit is contained in:
spezialspezial 2022-12-03 22:01:43 +01:00 committed by Kent Keirsey
parent 04e77f3858
commit 42f5bd4e12

View File

@ -227,7 +227,9 @@ class ModelCache(object):
model_hash = self._cached_sha256(weights,weight_bytes)
sd = torch.load(io.BytesIO(weight_bytes), map_location='cpu')
del weight_bytes
sd = sd['state_dict']
# merged models from auto11 merge board are flat for some reason
if 'state_dict' in sd:
sd = sd['state_dict']
model = instantiate_from_config(omega_config.model)
model.load_state_dict(sd, strict=False)