fix autocast (#1459)

This commit is contained in:
lllyasviel 2023-12-16 17:16:24 -08:00 committed by GitHub
parent 085bc3aeaa
commit efb312d495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1 +1 @@
version = '2.1.847'
version = '2.1.848'

View File

@ -72,7 +72,6 @@ class SDClipModelFooocus(torch.nn.Module, ldm_patched.modules.sd1_clip.ClipToken
]
def __init__(self,
device="cpu",
max_length=77,
freeze=True,
layer="last",
@ -97,6 +96,9 @@ class SDClipModelFooocus(torch.nn.Module, ldm_patched.modules.sd1_clip.ClipToken
with modeling_utils.no_init_weights():
self.transformer = CLIPTextModel(config)
if 'cuda' not in model_management.text_encoder_device().type:
dtype = torch.float32
if dtype is not None:
self.transformer.to(dtype)
self.transformer.text_model.embeddings.to(torch.float32)
@ -241,6 +243,9 @@ class ClipVisionModelFooocus:
else:
self.dtype = torch.float32
if 'cuda' not in self.load_device.type:
self.dtype = torch.float32
with modeling_utils.no_init_weights():
self.model = CLIPVisionModelWithProjection(config)