[Bug]: split_list(contiguous=True) creates empty leading shards and starves rank 0 when num_shards > len(list)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #10396 di @xuilen — chiusa senza merge
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
Read split_list and its tests in tests/utils/test_split_list.py; reproduce the two-item, four-shard example from the issue. Check that contiguous shards keep elements in order and place remainder items in the leading shards. The issue says a linked pull request is already open, so confirm its status before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Checklist / 检查清单
- I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
When calling split_list(ori_list, num_shards, contiguous=True) where num_shards > len(ori_list) (or when remainder exists across uneven shards), the function uses np.linspace(0, len(ori_list), num_shards + 1, dtype=np.int64) for slice indexing.
Because float truncation occurs when casting np.linspace to np.int64, for example with split_list([1, 2], 4, contiguous=True):
np.linspace(0, 2, 5, dtype=np.int64)produces[0, 0, 1, 1, 2].- The resulting slices are:
- Shard 0:
ori_list[0:0]->[](Rank 0 gets empty!) - Shard 1:
ori_list[0:1]->[1] - Shard 2:
ori_list[1:1]->[] - Shard 3:
ori_list[1:2]->[2]
- Shard 0:
- Resulting shards:
[[], [1], [], [2]].
This causes Rank 0 (shard 0, usually the primary/master worker in distributed data processing) to receive an empty shard [], while items are scattered across subsequent ranks.
In contrast, split_list(..., contiguous=False) and standard partitioning tools (torch.chunk, np.array_split) always pack non-empty elements into the leading shards: [[1], [2], [], []].
How to Reproduce / 如何复现
from swift.utils import split_list
# 2 items split across 4 shards with contiguous=True
res = split_list([1, 2], 4, contiguous=True)
print(res)
# Actual output: [[], [1], [], [2]] (Rank 0 gets empty list!)
# Expected output: [[1], [2], [], []] (consistent with contiguous=False and standard chunking)
Additional Information / 补充信息
Using integer arithmetic q, r = divmod(len(ori_list), num_shards) ensures balanced contiguous slices without float truncation artifacts, and places any remainder elements in the first r shards.
A patch with updated unit tests in tests/utils/test_split_list.py is ready to submit.
- Lingua principale
- Python
- Stelle
- 16.2k
- Fork
- 1.8k
- Merge medio
- 1g 14h
- PR unite (30g)
- 68
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelscope/ms-swift
-
get_multimodal_target_regex(..., exclude_router=True) does not exclude shared_expert_gateForse già presa @KonnyakuMatcha l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10696 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss crashes with beta>0 and kl_in_reward=True (NoneType * Tensor)Forse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
modelscope/ms-swift#10690 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss divides by all groups instead of valid groups, silently scaling gradientsForse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10688 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
modelscope/ms-swift#10621 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] `get_seed` consumes a draw from the shared RandomState even when decision augmentation is disabled, changing the train/val split and dataset shuffleForse già presa @ryznren l’ha presa 38 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelscope/ms-swift#10466 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelscope/ms-swift
Issue simili
-
Test: to_hijri() accepts datetime.datetime and uses only the date partForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagood first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
polish
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresForse già presa @AshutoshSingh840 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
UKGovernmentBEIS/control-arena#992 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
mvalentsev/awesome-free-ai-coding#70 ·
I maintainer di solito rispondono entro 1 giorno