The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Fix lowvram issues with hunyuan3d 2.1 (#9735)
comfyanonymous2ee7879a0bdb
diff --git a/comfy/ldm/hunyuan3dv2_1/hunyuandit.py b/comfy/ldm/hunyuan3dv2_1/hunyuandit.pyindex 48575bb3c..ca1a83001 100644--- a/comfy/ldm/hunyuan3dv2_1/hunyuandit.py+++ b/comfy/ldm/hunyuan3dv2_1/hunyuandit.py@@ -3,6 +3,7 @@ import torchimport torch.nn as nnimport torch.nn.functional as Ffrom comfy.ldm.modules.attention import optimized_attention+import comfy.model_managementclass GELU(nn.Module):@@ -88,7 +89,7 @@ class MoEGate(nn.Module):hidden_states = hidden_states.view(-1, hidden_states.size(-1))# get logits and pass it to softmax- logits = F.linear(hidden_states, self.weight, bias = None)+ logits = F.linear(hidden_states, comfy.model_management.cast_to(self.weight, dtype=hidden_states.dtype, device=hidden_states.device), bias = None)scores = logits.softmax(dim = -1)topk_weight, topk_idx = torch.topk(scores, k = self.top_k, dim = -1, sorted = False)@@ -255,7 +256,7 @@ class TimestepEmbedder(nn.Module):cond_embed = self.cond_proj(condition)timestep_embed = timestep_embed + cond_embed- time_conditioned = self.mlp(timestep_embed.to(self.mlp[0].weight.device))+ time_conditioned = self.mlp(timestep_embed)# for broadcasting with image tokensreturn time_conditioned.unsqueeze(1)