applispee
/

GGUF
Anima-GGUF / anima_gguf_patch.py
applispee's picture
Duplicate from Bedovyy/Anima-GGUF
a4b901d
# A very basic ComfyUI plugin to patch anima to use GGUF.
# Only tested for anima.
# Based on reakaakasky (https://civitai.com/user/reakaakasky).
# To clarify, this plugin isn't uploaded to GitHub because it's a very "dirty" plugin.
# "dirty" means it hot-patches/monkey patches the comfyui core code.
# This approach is terrible from a programming perspective.
# But this is the simplest approach I can think of.
# How to use:
# Put this file in the ComfyUI "custom_nodes" dir.
# To disable the patch, remove the file, or rename the ".py" suffix, to something
# like ".disable", whatever.
# Version: v1 (2/9/2026)
import torch
import logging
logger = logging.getLogger(__name__)
logger.info("[anima gguf patch] patch loading")
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
ampf32 = torch.autocast("cuda", dtype=torch.float32)
import comfy.ldm.anima.model as anima
def anima_Attention_init_patch(self: anima.Attention, *args, **kwargs):
self.__init_anima(*args, **kwargs)
self.forward = ampf32(self.forward)
anima.Attention.__init_anima = anima.Attention.__init__
anima.Attention.__init__ = anima_Attention_init_patch
logger.info("[anima gguf patch] patch loaded")