r'''support standalone evaluation.
(self,
input_fn,
steps=None,
hooks=None,
checkpoint_path=None,
name=None)
| 1095 | saving_listeners=saving_listeners) |
| 1096 | |
| 1097 | def evaluate(self, |
| 1098 | input_fn, |
| 1099 | steps=None, |
| 1100 | hooks=None, |
| 1101 | checkpoint_path=None, |
| 1102 | name=None): |
| 1103 | r'''support standalone evaluation. |
| 1104 | ''' |
| 1105 | _estimator_lib._estimator_api_gauge.get_cell( |
| 1106 | 'evaluate').set(True) # pylint: disable=protected-access |
| 1107 | if self.config.cluster_spec: |
| 1108 | if estimator_training.should_run_distribute_coordinator(self.config): |
| 1109 | raise ValueError( |
| 1110 | 'Running `evaluate` with Distribute Coordinator ' |
| 1111 | 'not supported.') |
| 1112 | if not _is_google_env(): |
| 1113 | start_std_server(self.config) |
| 1114 | |
| 1115 | start_delay_secs = 0 |
| 1116 | if self.config.task_type == run_config_lib.TaskType.WORKER: |
| 1117 | max_delay_secs = _MAX_DELAY_SECS |
| 1118 | if self.config.experimental_max_worker_delay_secs is not None: |
| 1119 | max_delay_secs = int( |
| 1120 | self.config.experimental_max_worker_delay_secs) |
| 1121 | start_delay_secs = min( |
| 1122 | max_delay_secs, |
| 1123 | (self.config.task_id + 1) * _DELAY_SECS_PER_WORKER) |
| 1124 | |
| 1125 | if start_delay_secs > 0: |
| 1126 | logging.info( |
| 1127 | f'Waiting {start_delay_secs} secs before starting evaluation.') |
| 1128 | time.sleep(start_delay_secs) |
| 1129 | |
| 1130 | return self._actual_eval( |
| 1131 | input_fn, |
| 1132 | strategy=self._eval_distribution, |
| 1133 | steps=steps, |
| 1134 | hooks=hooks, |
| 1135 | checkpoint_path=checkpoint_path, |
| 1136 | name=name) |
| 1137 | |
| 1138 | def _actual_eval( |
| 1139 | self, input_fn, strategy=None, steps=None, hooks=None, |