From 00a9189e303c4e7471da2d799f69853fcf790546 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 19 Feb 2023 16:59:03 -0500 Subject: [PATCH] Support old pytorch. --- comfy/sd1_clip.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 3840538..998babe 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -186,7 +186,10 @@ def load_embed(embedding_name, embedding_directory): import safetensors.torch embed = safetensors.torch.load_file(embed_path, device="cpu") else: - embed = torch.load(embed_path, weights_only=True, map_location="cpu") + if 'weights_only' in torch.load.__code__.co_varnames: + embed = torch.load(embed_path, weights_only=True, map_location="cpu") + else: + embed = torch.load(embed_path, map_location="cpu") if 'string_to_param' in embed: values = embed['string_to_param'].values() else: