fix: keep LDF transformer dtypes aligned

This commit is contained in:
Ethan Fel
2026-08-15 21:58:53 +02:00
parent fa6d8a7d88
commit a4831d7b71
2 changed files with 31 additions and 5 deletions
+6 -5
View File
@@ -187,11 +187,12 @@ class LDFVFIModel:
target = torch.device(device)
if target.type == "cuda" and not _cuda_bf16_supported(target):
raise RuntimeError("LDF-VFI requires a CUDA GPU with BF16 support (Ampere or newer)")
# from_pretrained(torch_dtype=...) keeps numerically sensitive modules
# (time embedding, norms, scale/shift) in FP32. Passing dtype here would
# flatten that mixed-precision policy and diffusers warns that results
# can become inconsistent.
self.transformer.to(device=target)
# LDF's custom Wan fork expects its complete condition embedder to use
# one dtype: time_embedder feeds time_proj directly without an explicit
# cast. Match the official generator's model.to(..., dtype=BF16) call;
# preserving diffusers' generic FP32-module policy leaves that pair as
# Float/BFloat16 and fails in the first sampling step.
self.transformer.to(device=target, dtype=self.dtype)
self._move_auxiliary_models(target)
self.device = str(target)
return self