Skip to content

Commit ee615ac

Browse files
Add warning when loading file unsafely. (Comfy-Org#8800)
1 parent 27870ec commit ee615ac

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

comfy/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def load_torch_file(ckpt, safe_load=False, device=None, return_metadata=False):
7777
if safe_load or ALWAYS_SAFE_LOAD:
7878
pl_sd = torch.load(ckpt, map_location=device, weights_only=True, **torch_args)
7979
else:
80+
logging.warning("WARNING: loading {} unsafely, upgrade your pytorch to 2.4 or newer to load this file safely.".format(ckpt))
8081
pl_sd = torch.load(ckpt, map_location=device, pickle_module=comfy.checkpoint_pickle)
8182
if "state_dict" in pl_sd:
8283
sd = pl_sd["state_dict"]

0 commit comments

Comments
 (0)