[Perf] Optimize memory peak during EAGLE model loading. (#24585)

Signed-off-by: Chen Ding <candy.dc@alibaba-inc.com>
This commit is contained in:
Chen Ding
2025-09-19 03:31:16 +00:00
committed by GitHub
parent 6d8246aaff
commit 1a0a04dae9
3 changed files with 26 additions and 26 deletions
+8 -7
View File
@@ -229,14 +229,15 @@ class EagleDeepseekV3ForCausalLM(DeepseekV3ForCausalLM):
return logits
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]):
def transform(inputs):
name, loaded_weight = inputs
if "lm_head" not in name:
name = "model." + name
return name, loaded_weight
loader = AutoWeightsLoader(
self,
skip_prefixes=None,
)
model_weights = {}
for name, loaded_weight in weights:
if "lm_head" not in name:
name = "model." + name
model_weights[name] = loaded_weight
loader.load_weights(model_weights.items())
loader.load_weights(map(transform, weights))