[Bug] DeepSpeedDataSampler gates DP-group sampling on global_rank == 0 and broadcasts with raw src=0, crashing non-zero DP groups under 2D/3D parallelism
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- data-engineering, distributed-systems, machine-learning
Hướng nghiên cứu
Start with deepspeed/runtime/data_pipeline/data_sampling/data_sampler.py, especially DeepSpeedDataSampler.__init__, get_new_cluster, get_next_global_batch, and load_state_dict. Trace how data_parallel_group, data_parallel_rank, and global_rank are used for cluster loading, state restoration, and distributed broadcasts. Extend tests/unit/runtime/test_data_efficiency.py with the multi-dimensional parallel setup described in the issue and verify that each DP group samples consistently without a missing-global-rank error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
In deepspeed/runtime/data_pipeline/data_sampling/data_sampler.py (commit a695f646974c6c92da2a9028bbafde8bb28bad1e, present at HEAD), DeepSpeedDataSampler assumes that the leader of self.data_parallel_group is always global rank 0:
# deepspeed/runtime/data_pipeline/data_sampling/data_sampler.py:79-85, 178-227, 284-301, 354-358
# In __init__:
if self.global_rank == 0:
self.data_clusters = []
self.data_cluster_sizes = []
...
# In get_new_cluster:
if self.global_rank == 0:
...
self.data_clusters.append(MMapIndexedDataset(cluster_path, skip_warmup=True))
self.data_cluster_sizes.append(len(self.data_clusters[-1][0]))
dist.barrier(group=self.data_parallel_group)
# In get_next_global_batch:
if self.global_rank == 0:
samples_per_cluster = self.sample_from_clusters()
...
batch = torch.tensor(batch, device=get_accelerator().current_device_name(), dtype=torch.long).view(-1)
else:
batch = torch.empty(self.global_batch_size,
device=get_accelerator().current_device_name(),
dtype=torch.long)
dist.broadcast(batch, 0, group=self.data_parallel_group)
Whenever any orthogonal parallelism dimension is enabled (TP > 1, PP > 1, or SP > 1), ranks with non-zero TP/PP/SP coordinates belong to a data_parallel_group that does not contain global rank 0 (for example, under TP=2, DP=2, DP group 0 is [0, 2] and DP group 1 is [1, 3]). On every non-zero DP group:
dist.broadcast(batch, 0, group=self.data_parallel_group)(line 299) passes raw global rank0instead ofdist.get_global_rank(self.data_parallel_group, 0), immediately raisingValueError: Global rank 0 is not part of groupon the very first batch.self.global_rank == 0in__init__(lines 79, 93),get_new_cluster(line 178),get_next_global_batch(line 284), andload_state_dict(line 354) leavesself.data_clustersandself.data_cluster_sizesuninitialized ondata_parallel_rank == 0of every non-zero DP group.dist.barrier(group=self.data_parallel_group)at line 227 only synchronizes within each DP group rather than across the world, allowing non-zero DP groups to race past global rank0while cluster files are being written to shared disk.
Existing tests/unit/runtime/test_data_efficiency.py only tests single-group DP (TP=1, PP=1), where global rank 0 is present in the sole DP group.
Affected Location
- Repository:
deepspeedai/DeepSpeed(a695f646974c6c92da2a9028bbafde8bb28bad1e, present atHEAD) - File & lines:
deepspeed/runtime/data_pipeline/data_sampling/data_sampler.py:79-103,178-230,284-301,354-358(DeepSpeedDataSampler.__init__,get_new_cluster,get_next_global_batch,load_state_dict)
Minimal Standalone Reproduction
import os
import torch.distributed as dist
from deepspeed.runtime.data_pipeline.data_sampling.data_sampler import DeepSpeedDataSampler
def worker(rank, cluster_dir):
os.environ["RANK"] = str(rank)
os.environ["WORLD_SIZE"] = "4"
dist.init_process_group("gloo", rank=rank, world_size=4)
# 2D parallelism: TP=2, DP=2 -> DP groups [0, 2] and [1, 3]
dp_g0 = dist.new_group(ranks=[0, 2])
dp_g1 = dist.new_group(ranks=[1, 3])
my_dp_group = dp_g0 if rank in (0, 2) else dp_g1
dp_rank = 0 if rank in (0, 1) else 1
sampler = DeepSpeedDataSampler(
data_efficiency_config=config,
one_epoch_total_samples=20,
micro_batch_size=2,
data_parallel_rank=dp_rank,
data_parallel_size=2,
data_parallel_group=my_dp_group,
gradient_accumulation_steps=1,
global_rank=rank,
)
sampler.get_next_global_batch()
Observed behavior / output (4-process Gloo execution against verbatim DeepSpeedDataSampler):
- Rank
0(dp_rank=0, group[0, 2]):OK,sampler.batch = [16, 18, 3, 9] - Rank
2(dp_rank=1, group[0, 2]):OK,sampler.batch = [16, 18, 3, 9] - Rank
1(dp_rank=0, group[1, 3]):ValueError: Global rank 0 is not part of group <torch.distributed.distributed_c10d.ProcessGroup ...> - Rank
3(dp_rank=1, group[1, 3]):ValueError: Global rank 0 is not part of group <torch.distributed.distributed_c10d.ProcessGroup ...>
Suggested Fix
- Gate per-DP-group cluster loading, batch sampling, and state restoration (
__init__,get_next_global_batch,load_state_dict) onself.data_parallel_rank == 0instead ofself.global_rank == 0. - In
get_next_global_batch(line 299), pass the DP group's global rank 0 (dist.get_global_rank(self.data_parallel_group, 0)) todist.broadcast(batch, src, group=self.data_parallel_group). - In
get_new_cluster, have global rank0write the shared.bin/.idxcluster files on disk, synchronize across the world (dist.barrier(), or a filesystem-safe world barrier) so non-zero DP groups never race file creation, and then let each DP group'sdata_parallel_rank == 0open the finalizedMMapIndexedDatasetfor deterministic DP sampling.
- Ngôn ngữ chính
- Python
- Star
- 43.3k
- Fork
- 5.1k
- Merge trung bình
- 5 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 85
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của deepspeedai/DeepSpeed
-
[Bug] DeepSpeedEngine.step leaves _running_engine_step=True permanently on exception, corrupting is_gradient_accumulation_boundary()Có thể đã có người làm @its-amann đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
deepspeedai/DeepSpeed#9190 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] PipelineEngine._exec_reduce_grads and _exec_optimizer_step leave _force_grad_boundary=True permanently after any exceptionCó thể đã có người làm @bantianyue đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepspeedai/DeepSpeed#9183 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
deepspeedai/DeepSpeed#9019 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
fp16 `hysteresis: 0` (or negative) makes DynamicLossScaler never lower the loss scale, so every overflowing step is skipped foreverCó thể đã có người làm @damienen đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
deepspeedai/DeepSpeed#8982 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] OneCycle applies the minimum momentum to the first Adam updateCó thể đã có người làm @ai-yang đã nhận 30 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepspeedai/DeepSpeed#8951 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của deepspeedai/DeepSpeed
Issue tương tự
-
area/auth comp/agent P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#161417 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Dao-AILab/flash-attention#3251 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[New Check]: sqlserver_public_network_access_disabledCó thể đã có người làm @pouria-l đã nhận hôm nay. Đang mởfeature-request status/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
prowler-cloud/prowler#13607 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
external langchain
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
langchain-ai/docs#8184 ·
Maintainer thường phản hồi trong vòng 1 ngày