File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 44# This source code is licensed under the BSD-style license found in the
55# LICENSE file in the root directory of this source tree.
66
7+ import asyncio
78import heapq
89import itertools
910import logging
@@ -715,12 +716,13 @@ def push(self, metric: Metric) -> None:
715716
716717 # For PER_RANK_NO_REDUCE backends: stream without reduce
717718 for backend in self .per_rank_no_reduce_backends :
718- # if metric.reduction == Reduce.SAMPLE:
719- # # Wrap singleton Metric into expected {key: [list_of_dicts]} format
720- # sample = {metric.key: [metric.value]}
721- # asyncio.create_task(backend.log_samples(sample, self.global_step))
722- # else:
723- backend .log_stream (metric = metric , global_step = self .global_step )
719+
720+ if metric .reduction == Reduce .SAMPLE :
721+ # Wrap singleton Metric into expected {key: [list_of_dicts]} format
722+ sample = {metric .key : [metric .value ]}
723+ asyncio .create_task (backend .log_samples (sample , self .global_step ))
724+ else :
725+ backend .log_stream (metric = metric , global_step = self .global_step )
724726
725727 # Always accumulate for reduction and state return
726728 key = metric .key
You can’t perform that action at this time.
0 commit comments