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.
This commit is contained in:
facok
2026-03-17 02:55:11 +08:00
parent b4e8dbd3d7
commit 600252d5d4
+8 -8
View File
@@ -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)