Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ python3 -m oneflow.distributed.launch \
--num-epochs $EPOCH \
--train-batch-size $TRAIN_BATCH_SIZE \
--val-batch-size $VAL_BATCH_SIZE \
--scale-grad
3 changes: 2 additions & 1 deletion Vision/classification/image/resnet50/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def train_one_epoch(self):
else:
top1_acc = 0

loss = loss * self.world_size
self.meter_train_iter(loss, top1_acc)

self.cur_batch += 1
Expand All @@ -269,7 +270,7 @@ def train_eager(self):
if loss.is_global and self.scale_grad:
# NOTE(zwx): scale init grad with world_size
# because global_tensor.mean() include dividor numel * world_size
loss = loss / self.world_size
# loss = loss / self.world_size
loss.backward()
for param_group in self.optimizer.param_groups:
for param in param_group.parameters:
Expand Down