diff --git a/fooocus_version.py b/fooocus_version.py index 0404a937..709af32d 100644 --- a/fooocus_version.py +++ b/fooocus_version.py @@ -1 +1 @@ -version = '2.1.847' +version = '2.1.848' diff --git a/modules/patch_clip.py b/modules/patch_clip.py index 8aa7468f..4a1e0307 100644 --- a/modules/patch_clip.py +++ b/modules/patch_clip.py @@ -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)