Skip to content

Commit 5171404

Browse files
chesterxgchenIsaacYangSLA
authored andcommitted
fix global steps
1 parent 764f118 commit 5171404

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/hello-world/step-by-step/cifar10/code/fl/train_with_mlflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def evaluate(input_weights):
139139
running_loss += loss.item()
140140
if i % 2000 == 1999: # print every 2000 mini-batches
141141
print(f"({client_id}) [{epoch + 1}, {i + 1:5d}] loss: {running_loss / 2000:.3f}")
142-
global_step = input_model.current_round * local_epochs * batch_size + epoch * batch_size + i
142+
global_step = input_model.current_round * steps + epoch * len(trainloader) + i
143143
mlflow.log_metric("loss", running_loss / 2000, global_step)
144144
running_loss = 0.0
145145

0 commit comments

Comments
 (0)