code: def eval_save(self):
      self.num_evals_since_improvement += 1
      val_results_dict = self.runner.run_val(
          task_name_list=self.runner.jiant_task_container.task_run_config.train_val_task_list,
          use_subset=True,
      )
      aggregated_major = jiant_task_sampler.compute_aggregate_major_metrics_from_results_dict(
          metrics_aggregator=self.runner.jiant_task_container.metrics_aggregator,
          results_dict=val_results_dict,
      )
      val_metrics_dict = (
          jiant_task_sampler.get_metrics_dict_from_results_dict(
              results_dict=val_results_dict,
          )
      )
      val_state = ValState(
          score=float(aggregated_major),
          metrics=val_metrics_dict,
          train_state=self.train_state.new(),
      )
      self.log_writer.write_entry("train_val", val_state.to_dict())
      if (
          self.best_val_state is None
          or val_state.score > self.best_val_state.score
      ):
          self.best_val_state = val_state.new()
          self.log_writer.write_entry(
              "train_val_best", self.best_val_state.to_dict()
          )
          del self.best_state_dict
          self.best_state_dict = copy_state_dict(
              state_dict=get_model_for_saving(self.model).state_dict(),
              target_device=CPU_DEVICE,
          )
          if self.save_best_model:
              self.save_best_model_with_metadata(
                  val_metrics_dict=val_metrics_dict
              )
          self.num_evals_since_improvement = 0
      self.log_writer.write_entry(
          "early_stopping",
          {
              "num_evals_since_improvement": self.num_evals_since_improvement,
              "train_state": self.train_state.to_dict(),
          },
      )
      self.log_writer.flush()
      self.val_state_history.append(val_state)
  
imports: from dataclasses import dataclass
  from typing import Dict
  import torch.nn
  import jiant.proj.main.runner
  import jiant.proj.main.components.task_sampler
  from jiant.shared.runner import save_model_with_metadata, compare_steps_max_steps
  from jiant.utils.python.datastructures import ExtendedDataClassMixin
  from jiant.utils.python.functional import always_false
  from jiant.utils.torch_utils import copy_state_dict, CPU_DEVICE, get_model_for_saving
  from jiant.utils.zlog import BaseZLogger, PRINT_LOGGER
  from jiant.shared.metarunner import AbstractMetarunner
label_desc: Use image node_id 18 for calling the JiantMetarunner obj's underlying member method code with example usage: obj.eval_save() without return types