(self, eval_task)
Initializes the per-task evaluator.
Initializes the per-task evaluator.
Initializes the per - task evaluator .
def _init_evaluator(self, eval_task):
    """Initializes the per-task evaluator."""
    model_with_metrics = _model_with_metrics(
        self._eval_model, eval_task)
    if self._use_memory_efficient_trainer:
      return _Evaluator(
          weights=tl.on_cpu(model_with_metrics.weights[1]),
          state=tl.on_cpu(model_with_metrics.state[1]),
          metrics_fn=_accelerate_model_with_metrics(model_with_metrics, 0)
      )
    else:
      return _Evaluator(
          # Replicate the eval part of weights and state.
          weights=self._for_n_devices(model_with_metrics.weights[1]),
          state=self._for_n_devices(model_with_metrics.state[1]),
          metrics_fn=_accelerate_model_with_metrics(
              model_with_metrics, self.n_devices)
      )
def _init_evaluator ( self , eval_task ) : model_with_metrics = _model_with_metrics ( self . _eval_model , eval_task ) if self . _use_memory_efficient_trainer : return _Evaluator ( weights = tl . on_cpu ( model_with_metrics . weights [ 1 ] ) , state = tl . on_cpu ( model_with_metrics . state [ 1 ] ) , metrics_fn = _accelerate_model_with_metrics ( model_with_metrics , 0 ) ) else : return _Evaluator ( # Replicate the eval part of weights and state. weights = self . _for_n_devices ( model_with_metrics . weights [ 1 ] ) , state = self . _for_n_devices ( model_with_metrics . state [ 1 ] ) , metrics_fn = _accelerate_model_with_metrics ( model_with_metrics , self . n_devices ) )