Commit 00a9189e authored by comfyanonymous's avatar comfyanonymous
Browse files

Support old pytorch.

parent 191af3ef
...@@ -186,7 +186,10 @@ def load_embed(embedding_name, embedding_directory): ...@@ -186,7 +186,10 @@ def load_embed(embedding_name, embedding_directory):
import safetensors.torch import safetensors.torch
embed = safetensors.torch.load_file(embed_path, device="cpu") embed = safetensors.torch.load_file(embed_path, device="cpu")
else: 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: if 'string_to_param' in embed:
values = embed['string_to_param'].values() values = embed['string_to_param'].values()
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment