MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / build_data_loader

Function build_data_loader

DeepSpeedExample/tasks/finetune_utils.py:74–92  ·  view source on GitHub ↗

Data loader. Note that batch-size is the local (per GPU) batch-size.

(dataset, batch_size, num_workers, drop_last)

Source from the content-addressed store, hash-verified

72
73
74def build_data_loader(dataset, batch_size, num_workers, drop_last):
75 """Data loader. Note that batch-size is the local (per GPU) batch-size."""
76
77 # Sampler.
78 world_size = mpu.get_data_parallel_world_size()
79 rank = mpu.get_data_parallel_rank()
80 sampler = torch.utils.data.distributed.DistributedSampler(
81 dataset, num_replicas=world_size, rank=rank)
82
83 # Data loader. Note that batch size is the per GPU batch size.
84 data_loader = torch.utils.data.DataLoader(dataset,
85 batch_size=batch_size,
86 sampler=sampler,
87 shuffle=False,
88 num_workers=num_workers,
89 drop_last=drop_last,
90 pin_memory=True)
91
92 return data_loader
93
94
95def _build_infinite_size_dataloader(dataloader):

Callers 3

accuracy_func_providerFunction · 0.90
mainFunction · 0.90

Calls 2

Tested by

no test coverage detected