forked from OSSInnovation/mindspore
warn when values duplicate and set mode to 'eval' to avoid extra recording
This commit is contained in:
parent
bc30576ac9
commit
97d8673018
|
@ -308,6 +308,8 @@ class SummaryCollector(Callback):
|
|||
else:
|
||||
self._collect_eval_lineage(cb_params)
|
||||
|
||||
# This is a workaround to avoid record '_summary_tensor_cache'.
|
||||
self._record.set_mode('eval')
|
||||
# There's nothing special about setting step to 0 here, just to satisfy the interface call
|
||||
self._record.record(step=0)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class WriterPool(Process):
|
|||
def run(self):
|
||||
writers = self._get_writers()
|
||||
|
||||
with Pool() as pool:
|
||||
with Pool(min(cpu_count(), 32)) as pool:
|
||||
deq = deque()
|
||||
while True:
|
||||
while deq and deq[0].ready():
|
||||
|
|
|
@ -202,6 +202,9 @@ class SummaryRecord:
|
|||
if not isinstance(value, Tensor):
|
||||
raise TypeError(f'Expect the value to be Tensor, but got {type(value).__name__}')
|
||||
np_value = _check_to_numpy(plugin, value)
|
||||
if name in {item['tag'] for item in self._data_pool[plugin]}:
|
||||
entry = repr(f'{name}/{plugin}')
|
||||
logger.warning(f'{entry} has duplicate values. Only the newest one will be recorded.')
|
||||
self._data_pool[plugin].append(dict(tag=name, mode=self._mode, value=np_value))
|
||||
|
||||
elif plugin in ('train_lineage', 'eval_lineage', 'dataset_graph', 'custom_lineage_data'):
|
||||
|
|
Loading…
Reference in New Issue