From 600252d5d4e636e58b378ebd3dadf23e04eb802c Mon Sep 17 00:00:00 2001 From: facok <128763816+facok@users.noreply.github.com> Date: Tue, 17 Mar 2026 02:55:11 +0800 Subject: [PATCH] Fix non-contiguous tensor error when saving calibration data PCA basis from torch.linalg.eigh produces non-contiguous tensors, which safetensors rejects. Add .contiguous() to all tensors at save time. --- nodes/calibrate.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nodes/calibrate.py b/nodes/calibrate.py index 401ce9a..a080217 100644 --- a/nodes/calibrate.py +++ b/nodes/calibrate.py @@ -51,10 +51,10 @@ class LCSCalibrate(io.ComfyNode): os.makedirs(DATA_DIR, exist_ok=True) save_path = os.path.join(DATA_DIR, "lcs_calibration.safetensors") save_file({ - "basis": lcs_data.basis, - "mean": lcs_data.mean, - "anchor_lcs": lcs_data.anchor_lcs, - "anchor_angles": lcs_data.anchor_angles, + "basis": lcs_data.basis.contiguous(), + "mean": lcs_data.mean.contiguous(), + "anchor_lcs": lcs_data.anchor_lcs.contiguous(), + "anchor_angles": lcs_data.anchor_angles.contiguous(), }, save_path) return io.NodeOutput(lcs_data) @@ -134,10 +134,10 @@ class LCSLoadData(io.ComfyNode): os.makedirs(DATA_DIR, exist_ok=True) save_path = os.path.join(DATA_DIR, "lcs_calibration.safetensors") save_file({ - "basis": lcs_data.basis, - "mean": lcs_data.mean, - "anchor_lcs": lcs_data.anchor_lcs, - "anchor_angles": lcs_data.anchor_angles, + "basis": lcs_data.basis.contiguous(), + "mean": lcs_data.mean.contiguous(), + "anchor_lcs": lcs_data.anchor_lcs.contiguous(), + "anchor_angles": lcs_data.anchor_angles.contiguous(), }, save_path) return io.NodeOutput(lcs_data)