mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-11-03 19:30:26 +00:00
Set sampler in DDP example
This commit is contained in:
parent
3c3dae0967
commit
208d8030c9
@ -133,6 +133,8 @@ def main(rank, world_size, num_epochs):
|
||||
# the core model is now accessible as model.module
|
||||
|
||||
for epoch in range(num_epochs):
|
||||
# NEW: Set sampler to ensure each epoch has a different shuffle order
|
||||
train_loader.sampler.set_epoch(epoch)
|
||||
|
||||
model.train()
|
||||
for features, labels in train_loader:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user