The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Remove pytorch_lightning dependency.
comfyanonymous735ac4cf8186
diff --git a/comfy/checkpoint_pickle.py b/comfy/checkpoint_pickle.pynew file mode 100644index 000000000..206551d3c--- /dev/null+++ b/comfy/checkpoint_pickle.py@@ -0,0 +1,13 @@+import pickle++load = pickle.load++class Empty:+ pass++class Unpickler(pickle.Unpickler):+ def find_class(self, module, name):+ #TODO: safe unpickle+ if module.startswith("pytorch_lightning"):+ return Empty+ return super().find_class(module, name)diff --git a/comfy/utils.py b/comfy/utils.pyindex 585ebda51..401eb8038 100644--- a/comfy/utils.py+++ b/comfy/utils.py@@ -1,6 +1,7 @@import torchimport mathimport struct+import comfy.checkpoint_pickledef load_torch_file(ckpt, safe_load=False):if ckpt.lower().endswith(".safetensors"):@@ -14,7 +15,7 @@ def load_torch_file(ckpt, safe_load=False):if safe_load:pl_sd = torch.load(ckpt, map_location="cpu", weights_only=True)else:- pl_sd = torch.load(ckpt, map_location="cpu")+ pl_sd = torch.load(ckpt, map_location="cpu", pickle_module=comfy.checkpoint_pickle)if "global_step" in pl_sd:print(f"Global Step: {pl_sd['global_step']}")if "state_dict" in pl_sd:diff --git a/requirements.txt b/requirements.txtindex c551f6837..d632edf79 100644--- a/requirements.txt+++ b/requirements.txt@@ -4,7 +4,6 @@ torchsdeeinopstransformers>=4.25.1safetensors>=0.3.0-pytorch_lightningaiohttpacceleratepyyaml