meta init

This commit is contained in:
Yousef Rafat 2025-11-14 20:10:52 +02:00
parent 7b4c1e8031
commit 12cc6924ac

View File

@ -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()