Skip to content

Commit dc95321

Browse files
committed
fixed issue with downloading file when not distributed
Signed-off-by: Joshua Rosenkranz <jmrosenk@us.ibm.com>
1 parent 55ca17e commit dc95321

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

aiu_fms_testing_utils/utils/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,17 @@ def sample_sharegpt_requests(
518518
) -> List[Tuple[str, int]]:
519519
if not os.path.exists(dataset_path):
520520
print("downloading share-gpt dataset as it does not exist")
521-
if rank < 1:
521+
is_distributed_initialized = torch.distributed.is_initialized()
522+
if not is_distributed_initialized or rank < 1:
522523
__download_file(
523524
"https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json",
524525
dataset_path,
525526
)
526527
else:
527528
print("waiting for rank0 to complete download")
528-
torch.distributed.barrier()
529+
530+
if is_distributed_initialized:
531+
torch.distributed.barrier()
529532

530533
if enforce_sizes is None:
531534
enforce_sizes = []

0 commit comments

Comments
 (0)