def __init__(self, compare_fn, name='best-checkpoint',
               event_file_pattern='eval/*.tfevents.*'):
    """Construct the exporter.

    Args:
      compare_fn: Function that, given the dictionary of output
                  metrics of the previously best and current checkpoints,
                  returns whether to override the previously best checkpoint
                  with the current one.
      name: Name of the exporter
      event_file_pattern: where to look for events logs
    Raises:
      ValueError: if given incorrect arguments
    """
    self._name = name
    self._compare_fn = compare_fn
    if self._compare_fn is None:
      raise ValueError('`compare_fn` must not be None.')

    self._event_file_pattern = event_file_pattern
    self._model_dir = None
    self._best_eval_result = None
Construct the exporter.

    Args:
      compare_fn: Function that, given the dictionary of output
                  metrics of the previously best and current checkpoints,
                  returns whether to override the previously best checkpoint
                  with the current one.
      name: Name of the exporter
      event_file_pattern: where to look for events logs
    Raises:
      ValueError: if given incorrect arguments
    
language/boolq/utils/best_checkpoint_exporter.py