fix: strip inference flag before unnormalize in LoRA trainer eval

x1_pred is an inference tensor (computed from inference-mode weights
loaded by ComfyUI). generator.unnormalize() uses in-place mul_/add_
which fails on inference tensors. Clone strips the flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 20:01:53 +02:00
parent 1d1ae61409
commit 793368af18
+3 -1
View File
@@ -119,7 +119,9 @@ def _eval_sample(generator, feature_utils_orig, dataset, seq_cfg, device, dtype,
with torch.no_grad():
x1_pred = eval_fm.to_data(velocity_fn, x0)
x1_unnorm = generator.unnormalize(x1_pred)
# .clone() strips inference-mode flag from x1_pred (computed from
# inference-mode weights) so unnormalize's in-place ops don't fail.
x1_unnorm = generator.unnormalize(x1_pred.clone())
# Only move the VAE+vocoder (tod) to GPU — avoids moving the
# entire FeaturesUtils (CLIP, T5, Synchformer) which wastes VRAM