def begin(self, run_context): cb_params = run_context.original_args() self._check_callbacks(cb_params) if cb_params.mode not in ModeEnum.to_list(): raise ValueError( 'Only support `train` (model.train) and `eval` (model.eval) mode, ' 'but got `{cb_params.mode}` mode.') self._record.set_mode(cb_params.mode) if cb_params.mode == ModeEnum.TRAIN.value: # Note: if model.init is not executed then the computed graph will not be obtained here # The purpose of recording the graph here was to collect_freq if it was set to a large size, # but also want to see the graph as soon after compilation. self._collect_graphs(cb_params) self._collect_dataset_graph(cb_params) if self._custom_lineage_data and not self._has_saved_custom_data: packaged_custom_data = self._package_custom_lineage_data( self._custom_lineage_data) self._record.add_value('custom_lineage_data', 'custom_lineage_data', packaged_custom_data) self._has_saved_custom_data = True # There's nothing special about setting step to 0 here, just to satisfy the interface call self._record.record(step=0)
def begin(self, run_context): cb_params = run_context.original_args() self._check_callbacks(cb_params) if cb_params.mode not in ModeEnum.to_list(): raise ValueError( 'Only support `train` (model.train) and `eval` (model.eval) mode, ' 'but got `{cb_params.mode}` mode.') self._record.set_mode(cb_params.mode)
def begin(self, run_context): cb_params = run_context.original_args() self._check_callbacks(cb_params) if cb_params.mode not in ModeEnum.to_list(): raise ValueError( 'Only support `train` (model.train) and `eval` (model.eval) mode, ' 'but got `{cb_params.mode}` mode.') self._record.set_mode(cb_params.mode) if cb_params.mode == ModeEnum.TRAIN.value: if self._collect_tensor_freq is None: default_tensor_summary_limit = 20 total_step = cb_params.epoch_num * cb_params.batch_num self._collect_tensor_freq = max( self._collect_freq, total_step // default_tensor_summary_limit)