Skip to content

Commit 00a9189

Browse files
Support old pytorch.
1 parent 191af3e commit 00a9189

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

comfy/sd1_clip.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ def load_embed(embedding_name, embedding_directory):
186186
import safetensors.torch
187187
embed = safetensors.torch.load_file(embed_path, device="cpu")
188188
else:
189-
embed = torch.load(embed_path, weights_only=True, map_location="cpu")
189+
if 'weights_only' in torch.load.__code__.co_varnames:
190+
embed = torch.load(embed_path, weights_only=True, map_location="cpu")
191+
else:
192+
embed = torch.load(embed_path, map_location="cpu")
190193
if 'string_to_param' in embed:
191194
values = embed['string_to_param'].values()
192195
else:

0 commit comments

Comments
 (0)