From c1bb55144639bf91fb8d301c4a24c7cf1da450f3 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Sun, 17 May 2026 18:15:51 +0000 Subject: [PATCH] Fix weight loading: skip already-loaded experts correctly --- tests/test_pipeline_real_weights.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pipeline_real_weights.py b/tests/test_pipeline_real_weights.py index 61de57a0..46bbe279 100644 --- a/tests/test_pipeline_real_weights.py +++ b/tests/test_pipeline_real_weights.py @@ -55,7 +55,7 @@ def load_expert_weights(layer_idx, num_experts): for shard_path in shards: with safe_open(shard_path, framework="pt", device="cpu") as f: for e in range(num_experts): - if len(experts) > e: + if e < len(experts): continue prefix = f"model.layers.{layer_idx}.mlp.experts.{e}" gate_w = f"{prefix}.gate_proj.weight"