def __init__(self,
               eval_spec_name,
               serving_input_receiver_fn,
               compare_fn=None,
               metric_name=None,
               higher_is_better=True,
               assets_extra=None):
    """Creates an exporter that compares models on the given eval and metric.

    While the SavedModel is useful for inference, the checkpoint is useful for
    warm-starting another stage of training (e.g., fine-tuning).

    Args:
      eval_spec_name: Name of the EvalSpec to use to compare models.
      serving_input_receiver_fn: Callable that returns a ServingInputReceiver.
      compare_fn: Callable that compares eval metrics of two models.  See
        tf.estimator.BestExporter for details on the expected API.  Specify
        either this or `metric_name`.
      metric_name: Name of the eval metric to use to compare models.  Specify
        either this or `compare_fn`.
      higher_is_better: Whether higher or lower eval metric values are better.
        Only used when `metric_name` is specified.
      assets_extra: An optional dict specifying how to populate the
        `assets.extra` directory within the exported SavedModel. Each key should
        give the destination path (including the filename) relative to the
        `assets.extra` directory. The corresponding value gives the full path of
        the source file to be copied. For example, the simple case of copying a
        single file without renaming it is specified as
        {'my_asset_file.txt': '/path/to/my_asset_file.txt'}.
    """
    self._metric_name = metric_name

    def _default_compare_fn(best_eval_result, current_eval_result):
      """Returns True if the current metric is better than the best metric."""
      if higher_is_better:
        return current_eval_result[metric_name] > best_eval_result[metric_name]
      else:
        return current_eval_result[metric_name] < best_eval_result[metric_name]

    super(BestSavedModelAndCheckpointExporter, self).__init__(
        name="best_%s" % eval_spec_name,
        serving_input_receiver_fn=serving_input_receiver_fn,
        event_file_pattern="eval_%s/*.tfevents.*" % eval_spec_name,
        compare_fn=compare_fn or _default_compare_fn,
        assets_extra=assets_extra)
Creates an exporter that compares models on the given eval and metric.

    While the SavedModel is useful for inference, the checkpoint is useful for
    warm-starting another stage of training (e.g., fine-tuning).

    Args:
      eval_spec_name: Name of the EvalSpec to use to compare models.
      serving_input_receiver_fn: Callable that returns a ServingInputReceiver.
      compare_fn: Callable that compares eval metrics of two models.  See
        tf.estimator.BestExporter for details on the expected API.  Specify
        either this or `metric_name`.
      metric_name: Name of the eval metric to use to compare models.  Specify
        either this or `compare_fn`.
      higher_is_better: Whether higher or lower eval metric values are better.
        Only used when `metric_name` is specified.
      assets_extra: An optional dict specifying how to populate the
        `assets.extra` directory within the exported SavedModel. Each key should
        give the destination path (including the filename) relative to the
        `assets.extra` directory. The corresponding value gives the full path of
        the source file to be copied. For example, the simple case of copying a
        single file without renaming it is specified as
        {'my_asset_file.txt': '/path/to/my_asset_file.txt'}.
    
language/common/utils/exporters.py