Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/sglang/srt/model_loader/ci_weight_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,10 @@ def _validate_sharded_model(
for group_key, group_info in shard_groups.items():
total_shards = group_info["total"]
found_shards = set(group_info["found_shards"])
expected_shards = set(range(1, total_shards + 1))
# Shards may be 0-indexed (e.g. inclusionAI/Ring-2.5-1T) or 1-indexed
# (e.g. deepseek-ai/DeepSeek-V3); both are valid HF conventions.
min_idx = min(found_shards) if found_shards else 1
expected_shards = set(range(min_idx, min_idx + total_shards))
Comment on lines +1431 to +1432
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic using min(found_shards) to determine the starting index is fragile. If the first few shards are missing from the cache, min(found_shards) will shift the expected range, leading to confusing error messages (e.g., reporting shards beyond the actual total count as missing). Since Hugging Face models follow either 0-indexed or 1-indexed conventions, a more robust heuristic is to check if shard 0 is present. If it is, assume 0-indexing; otherwise, default to 1-indexing (which is the standard convention). Additionally, please note that validate_cache_lightweight (around line 1213) contains the same hardcoded 1-indexed logic and should be updated for consistency, although it is outside the current diff hunks.

Suggested change
min_idx = min(found_shards) if found_shards else 1
expected_shards = set(range(min_idx, min_idx + total_shards))
min_idx = 0 if 0 in found_shards else 1
expected_shards = set(range(min_idx, min_idx + total_shards))


# Check for missing shards
missing_shards = expected_shards - found_shards
Expand Down
Loading