modify eval

pull/5897/head
liuyang_655 5 years ago
parent b7425d3e0c
commit 706f32a940

@ -535,10 +535,9 @@ class Model:
""" """
Training API where the iteration is controlled by python front-end. Training API where the iteration is controlled by python front-end.
When setting pynative mode, the training process will be performed with dataset not sink. When setting pynative mode or CPU, the training process will be performed with dataset not sink.
Note: Note:
CPU is not supported when dataset_sink_mode is true.
If dataset_sink_mode is True, epoch of training should be equal to the count of repeat If dataset_sink_mode is True, epoch of training should be equal to the count of repeat
operation in dataset processing. Otherwise, errors could occur since the amount of data operation in dataset processing. Otherwise, errors could occur since the amount of data
is not equal to the required amount of training . is not equal to the required amount of training .
@ -558,7 +557,7 @@ class Model:
function respectively. function respectively.
callbacks (list): List of callback objects which should be executed while training. Default: None. callbacks (list): List of callback objects which should be executed while training. Default: None.
dataset_sink_mode (bool): Determines whether to pass the data through dataset channel. Default: True. dataset_sink_mode (bool): Determines whether to pass the data through dataset channel. Default: True.
Configure pynative mode, the training process will be performed with Configure pynative mode or CPU, the training process will be performed with
dataset not sink. dataset not sink.
sink_size (int): Control the amount of data in each sink. sink_size (int): Control the amount of data in each sink.
If sink_size = -1, sink the complete dataset for each epoch. If sink_size = -1, sink the complete dataset for each epoch.
@ -667,10 +666,9 @@ class Model:
""" """
Evaluation API where the iteration is controlled by python front-end. Evaluation API where the iteration is controlled by python front-end.
Configure to pynative mode, the evaluation will be performed with dataset non-sink mode. Configure to pynative mode or CPU, the evaluating process will be performed with dataset non-sink mode.
Note: Note:
CPU is not supported when dataset_sink_mode is true.
If dataset_sink_mode is True, data will be sent to device. If device is Ascend, features If dataset_sink_mode is True, data will be sent to device. If device is Ascend, features
of data will be transferred one by one. The limitation of data transmission per time is 256M. of data will be transferred one by one. The limitation of data transmission per time is 256M.
@ -708,6 +706,11 @@ class Model:
self._clear_metrics() self._clear_metrics()
if context.get_context("device_target") == "CPU":
dataset_sink_mode = False
logger.warning("CPU cannot support dataset sink mode currently."
"So the evaluating process will be performed with dataset non-sink mode.")
with _CallbackManager(callbacks) as list_callback: with _CallbackManager(callbacks) as list_callback:
if dataset_sink_mode: if dataset_sink_mode:
return self._eval_dataset_sink_process(valid_dataset, list_callback, cb_params) return self._eval_dataset_sink_process(valid_dataset, list_callback, cb_params)

Loading…
Cancel
Save