Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix missing variables and argument changes to MegatronPretrainingRandomSampler #9458

Merged
merged 2 commits into from
Jun 13, 2024
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
4 changes: 2 additions & 2 deletions nemo/lightning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def add_megatron_sampler(
)
elif dataloader_type == 'cyclic':
batch_sampler = MegatronPretrainingRandomSampler(
dataloader.dataset,
total_samples=len(dataloader.dataset),
consumed_samples=consumed_samples,
micro_batch_size=micro_batch_size,
Expand Down Expand Up @@ -259,8 +258,9 @@ def __iter__(self):
assert current_epoch_samples % self.micro_batch_times_data_parallel_size == 0

# data sharding and random sampling
data_parallel_size = self.micro_batch_times_data_parallel_size // self.micro_batch_size
bucket_size = (self.total_samples // self.micro_batch_times_data_parallel_size) * self.micro_batch_size
bucket_offset = current_epoch_samples // self.data_parallel_size
bucket_offset = current_epoch_samples // data_parallel_size
start_idx = self.data_parallel_rank * bucket_size

g = torch.Generator()
Expand Down
Loading