From 12cc6924ac2c954512232dd07b4dca0cd0f5fe8c Mon Sep 17 00:00:00 2001 From: Yousef Rafat <81116377+yousef-rafat@users.noreply.github.com> Date: Fri, 14 Nov 2025 20:10:52 +0200 Subject: [PATCH] meta init --- comfy/ldm/hunyuan_image_3/model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/hunyuan_image_3/model.py b/comfy/ldm/hunyuan_image_3/model.py index 9682a270f..11eb29d9e 100644 --- a/comfy/ldm/hunyuan_image_3/model.py +++ b/comfy/ldm/hunyuan_image_3/model.py @@ -580,7 +580,11 @@ class LazyMoELoader(nn.Module): new_k = k.split(f"experts.{expert_idx}.", 1)[1] sd[new_k] = f.get_tensor(k) - return HunyuanMLP(self.config, layer_idx=layer_idx, is_shared_mlp=False, is_moe=True).load_state_dict(sd) + model = HunyuanMLP(self.config, layer_idx=layer_idx, is_shared_mlp=False, is_moe=True, device="meta") + model.to_empty(device = "cpu") + + model.load_state_dict(sd) + return model async def lazy_load_from_disk(self, layer_idx, expert_idx): loop = asyncio.get_event_loop()