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:
+8
-8
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user