fix autocast (#1459)
This commit is contained in:
parent
085bc3aeaa
commit
efb312d495
|
|
@ -1 +1 @@
|
|||
version = '2.1.847'
|
||||
version = '2.1.848'
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue