Skip to content

Commit 002e8e7

Browse files
authored
Maintain the order of union metric list in distributed training (#321)
1 parent 13a194f commit 002e8e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sagemaker_xgboost_container/algorithm_mode/train_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def get_union_metrics(metric_a, metric_b):
3636
elif metric_b is None:
3737
return metric_a
3838
else:
39-
metric_list = list(set(metric_a).union(metric_b))
39+
# The order of metric_list need to be consistent among all hosts in distributed training
40+
# So we have metric_list sorted here.
41+
metric_list = sorted(list(set(metric_a).union(metric_b)))
4042
return metric_list
4143

4244

0 commit comments

Comments
 (0)