Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
e1278fa9
Commit
e1278fa9
authored
May 25, 2023
by
comfyanonymous
Browse files
Support old pytorch versions that don't have weights_only.
parent
9b1396e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
comfy/utils.py
comfy/utils.py
+4
-0
No files found.
comfy/utils.py
View file @
e1278fa9
...
...
@@ -6,6 +6,10 @@ def load_torch_file(ckpt, safe_load=False):
import
safetensors.torch
sd
=
safetensors
.
torch
.
load_file
(
ckpt
,
device
=
"cpu"
)
else
:
if
safe_load
:
if
not
'weights_only'
in
torch
.
load
.
__code__
.
co_varnames
:
print
(
"Warning torch.load doesn't support weights_only on this pytorch version, loading unsafely."
)
safe_load
=
False
if
safe_load
:
pl_sd
=
torch
.
load
(
ckpt
,
map_location
=
"cpu"
,
weights_only
=
True
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment