Switch text encoder to manual cast.

Use fp16 text encoder weights for CPU inference to lower memory usage.
This commit is contained in:
comfyanonymous
2023-12-10 23:00:54 -05:00
parent 69033081c5
commit 57926635e8
3 changed files with 59 additions and 29 deletions

View File

@@ -503,6 +503,9 @@ def text_encoder_dtype(device=None):
elif args.fp32_text_enc:
return torch.float32
if is_device_cpu(device):
return torch.float16
if should_use_fp16(device, prioritize_performance=False):
return torch.float16
else: