Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Some fixes to previous pr. (#12339)

comfyanonymous039955c52744
diff --git a/comfy/ldm/cosmos/predict2.py b/comfy/ldm/cosmos/predict2.py
index 6491e486b..2268bff38 100644
--- a/comfy/ldm/cosmos/predict2.py
+++ b/comfy/ldm/cosmos/predict2.py
@@ -894,6 +894,6 @@ class MiniTrainDIT(nn.Module):
**block_kwargs,
)
- x_B_T_H_W_O = self.final_layer(x_B_T_H_W_D, t_embedding_B_T_D, adaln_lora_B_T_3D=adaln_lora_B_T_3D)
+ x_B_T_H_W_O = self.final_layer(x_B_T_H_W_D.to(crossattn_emb.dtype), t_embedding_B_T_D, adaln_lora_B_T_3D=adaln_lora_B_T_3D)
x_B_C_Tt_Hp_Wp = self.unpatchify(x_B_T_H_W_O)[:, :, :orig_shape[-3], :orig_shape[-2], :orig_shape[-1]]
return x_B_C_Tt_Hp_Wp
diff --git a/comfy/supported_models.py b/comfy/supported_models.py
index 56a21b0ef..d33db7507 100644
--- a/comfy/supported_models.py
+++ b/comfy/supported_models.py
@@ -1025,10 +1025,6 @@ class Anima(supported_models_base.BASE):
supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32]
- def __init__(self, unet_config):
- super().__init__(unet_config)
- self.memory_usage_factor = (unet_config.get("model_channels", 2048) / 2048) * 0.95
-
def get_model(self, state_dict, prefix="", device=None):
out = model_base.Anima(self, device=device)
return out
@@ -1038,6 +1034,12 @@ class Anima(supported_models_base.BASE):
detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}qwen3_06b.transformer.".format(pref))
return supported_models_base.ClipTarget(comfy.text_encoders.anima.AnimaTokenizer, comfy.text_encoders.anima.te(**detect))
+ def set_inference_dtype(self, dtype, manual_cast_dtype, **kwargs):
+ self.memory_usage_factor = (self.unet_config.get("model_channels", 2048) / 2048) * 0.95
+ if dtype is torch.float16:
+ self.memory_usage_factor *= 1.4
+ return super().set_inference_dtype(dtype, manual_cast_dtype, **kwargs)
+
class CosmosI2VPredict2(CosmosT2IPredict2):
unet_config = {
"image_model": "cosmos_predict2",