๐Ÿ“ฆ Comfy-Org / ComfyUI

๐Ÿ“„ hook_breaker_ac10a0.py ยท 18 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18# Prevent custom nodes from hooking anything important
import comfy.model_management

HOOK_BREAK = [(comfy.model_management, "cast_to")]


SAVED_FUNCTIONS = []


def save_functions():
    for f in HOOK_BREAK:
        SAVED_FUNCTIONS.append((f[0], f[1], getattr(f[0], f[1])))


def restore_functions():
    for f in SAVED_FUNCTIONS:
        setattr(f[0], f[1], f[2])