This commit is contained in:
wailovet
2024-09-01 03:29:35 +08:00
parent 8da25fa84c
commit c6eca73aaa
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ class MZ_CogVideoXLoader:
"vae_name": (folder_paths.get_filename_list("vae"), ),
"weight_dtype": (["default", "fp8_e4m3fn", "fp8_e5m2"],),
"fp8_fast_mode": ("BOOLEAN", {"default": False}),
"dyn_offload_cpu_layer": ("INT", {"default": 0, "tooltip": "0-42,默认0不启用"}),
# "dyn_offload_cpu_layer": ("INT", {"default": 0, "tooltip": "0-42,默认0不启用"}),
"enable_sequential_cpu_offload": ("BOOLEAN", {"default": False, "tooltip": "significantly reducing memory usage and slows down the inference"}),
}}
+5 -2
View File
@@ -269,14 +269,17 @@ def MZ_CogVideoXLoader_call(args={}):
transformer.load_state_dict(unet_sd)
dtype = torch.bfloat16
dtype = None
weight_dtype = args.get("weight_dtype")
if weight_dtype == "fp8_e4m3fn":
dtype = torch.float8_e4m3fn
transformer.to(dtype)
elif weight_dtype == "fp8_e5m2":
dtype = torch.float8_e5m2
transformer.to(dtype)
else:
dtype = transformer.parameters().__next__().dtype
transformer.to(dtype)
if dtype == torch.float8_e4m3fn or dtype == torch.float8_e5m2:
fp8_fast_mode = args.get("fp8_fast_mode", False)
if fp8_fast_mode: