From 793368af181eb853816234789642acec7c4e478a Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Thu, 9 Apr 2026 20:01:53 +0200 Subject: [PATCH] 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 --- nodes/selva_lora_trainer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodes/selva_lora_trainer.py b/nodes/selva_lora_trainer.py index cfd6873..2273632 100644 --- a/nodes/selva_lora_trainer.py +++ b/nodes/selva_lora_trainer.py @@ -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