Download comfy_extras/nodes_torch_compile.py from fotographerai/Zen-Style-Shape: direct link, hf CLI and curl.
- Browser
- Download file 622 Bytes
-
https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/a8e42f9c629cb3adc0232d23fc09d1e375af4f5b/comfy_extras/nodes_torch_compile.py
- Command line
-
hf download hf://spaces/fotographerai/Zen-Style-Shape@a8e42f9c629cb3adc0232d23fc09d1e375af4f5b/comfy_extras/nodes_torch_compile.py
-
curl -L -o nodes_torch_compile.py https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/a8e42f9c629cb3adc0232d23fc09d1e375af4f5b/comfy_extras/nodes_torch_compile.py
622 Bytes
| import torch | |
| class TorchCompileModel: | |
| def INPUT_TYPES(s): | |
| return {"required": { "model": ("MODEL",), | |
| "backend": (["inductor", "cudagraphs"],), | |
| }} | |
| RETURN_TYPES = ("MODEL",) | |
| FUNCTION = "patch" | |
| CATEGORY = "_for_testing" | |
| EXPERIMENTAL = True | |
| def patch(self, model, backend): | |
| m = model.clone() | |
| m.add_object_patch("diffusion_model", torch.compile(model=m.get_model_object("diffusion_model"), backend=backend)) | |
| return (m, ) | |
| NODE_CLASS_MAPPINGS = { | |
| "TorchCompileModel": TorchCompileModel, | |
| } | |