mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 10:25:16 +00:00
d0b7ab88ba
It probably only works on Linux. For maximum speed on Flux with Nvidia 40 series/ada and newer try using this node with fp8_e4m3fn and the --fast argument.
22 lines
525 B
Python
22 lines
525 B
Python
import torch
|
|
|
|
class TorchCompileModel:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": { "model": ("MODEL",),
|
|
}}
|
|
RETURN_TYPES = ("MODEL",)
|
|
FUNCTION = "patch"
|
|
|
|
CATEGORY = "_for_testing"
|
|
EXPERIMENTAL = True
|
|
|
|
def patch(self, model):
|
|
m = model.clone()
|
|
m.add_object_patch("diffusion_model", torch.compile(model=m.get_model_object("diffusion_model")))
|
|
return (m, )
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"TorchCompileModel": TorchCompileModel,
|
|
}
|