1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-03 07:26:31 +08:00

Load flux t5 in fp8 if weights are in fp8.

This commit is contained in:
comfyanonymous
2024-08-01 11:05:56 -04:00
parent 8d34211a7a
commit 5f98de7697
4 changed files with 29 additions and 12 deletions

View File

@@ -54,14 +54,7 @@ class SD3ClipModel(torch.nn.Module):
self.clip_g = None
if t5:
if dtype_t5 is None:
dtype_t5 = dtype
elif comfy.model_management.dtype_size(dtype_t5) > comfy.model_management.dtype_size(dtype):
dtype_t5 = dtype
if not comfy.model_management.supports_cast(device, dtype_t5):
dtype_t5 = dtype
dtype_t5 = comfy.model_management.pick_weight_dtype(dtype_t5, dtype, device)
self.t5xxl = T5XXLModel(device=device, dtype=dtype_t5)
self.dtypes.add(dtype_t5)
else: