修复BUG

This commit is contained in:
AI_Architect
2026-06-23 09:52:03 +08:00
parent cf3e2b201f
commit e238d2eaea
2 changed files with 23 additions and 9 deletions
+21 -8
View File
@@ -205,9 +205,13 @@ class XB_WanSampler:
kw.update(extra)
r = _wan_import("nodes_sampler").WanVideoSampler().process(**kw)
if cleanup == "单次缓存清理":
torch.cuda.synchronize(); torch.cuda.empty_cache()
torch.cuda.synchronize()
torch.cuda.empty_cache()
elif cleanup == "双次缓存清理":
torch.cuda.synchronize(); mm.soft_empty_cache(); torch.cuda.empty_cache(); gc.collect()
torch.cuda.synchronize()
mm.soft_empty_cache()
torch.cuda.empty_cache()
gc.collect()
return r
@@ -262,8 +266,10 @@ class XB_WanVAELoader:
mod = _wan_import("wanvideo.wan_video_vae")
cls = mod.WanVideoVAE38 if sd["model.conv2.weight"].shape[0] == 48 else mod.WanVideoVAE
vae = cls(dtype=dtype, pruning_rate=pruning_rate, cpu_cache=use_cpu_cache)
vae.load_state_dict(sd); del sd
vae.eval(); vae.to(dtype=dtype)
vae.load_state_dict(sd)
del sd
vae.eval()
vae.to(dtype=dtype)
print(f" [XB_WanVAELoader] {model_name} | {precision} | pruning={pruning_rate}")
return (vae,)
@@ -293,12 +299,19 @@ class XB_WanDecode:
vae=vae, samples=samples, enable_vae_tiling=enable_vae_tiling,
tile_x=tile_x, tile_y=tile_y, tile_stride_x=tile_stride_x, tile_stride_y=tile_stride_y)
if cleanup == "单次缓存清理":
torch.cuda.synchronize(); torch.cuda.empty_cache()
torch.cuda.synchronize()
torch.cuda.empty_cache()
elif cleanup == "双次缓存清理":
torch.cuda.synchronize(); mm.soft_empty_cache(); torch.cuda.empty_cache(); gc.collect()
torch.cuda.synchronize()
mm.soft_empty_cache()
torch.cuda.empty_cache()
gc.collect()
elif cleanup == "卸载显存模型":
mm.unload_all_models(); mm.soft_empty_cache()
torch.cuda.synchronize(); torch.cuda.empty_cache(); gc.collect()
mm.unload_all_models()
mm.soft_empty_cache()
torch.cuda.synchronize()
torch.cuda.empty_cache()
gc.collect()
return r
+2 -1
View File
@@ -139,7 +139,8 @@ class XB_WanT5Loader:
if quantization == "disabled":
for v in sd.values():
if isinstance(v, torch.Tensor) and v.dtype == torch.float8_e4m3fn:
quantization = "fp8_e4m3fn"; break
quantization = "fp8_e4m3fn"
break
if "token_embedding.weight" not in sd and "shared.weight" not in sd:
raise ValueError("Invalid T5 model, expected 'umt5-xxl' format")
sd = _convert_t5_keys(sd)