deepvariant/model_eval.py
def _write_best_checkpoint(checkpoint_path, metrics_and_values, eval_name):
  """Writes files containing best checkpoint path and best checkpoint metrics.

  Args:
    checkpoint_path: str; a path to the best checkpoint.
    metrics_and_values: dict[string,object]; a dictionary of key/value pairs
      containing metrics for the best checkpoint we have seen. These will be
      converted to a JSON of key/string pairs and written out to disk.
    eval_name: str; the name of the eval run, which is used to derive the
      subdirectory of checkpoint_path where the eval metrics will be written.
  """
  best_checkpoint_path = checkpoint_metrics_path(
      checkpoint_path, eval_name, file_name='best_checkpoint.txt')
  best_checkpoint_metrics_path = checkpoint_metrics_path(
      checkpoint_path, eval_name, file_name='best_checkpoint.metrics')
  serializable = {k: str(v) for k, v in metrics_and_values.items()}
  logging.info('Writing new best checkpoint %s with values %s',
               best_checkpoint_path, metrics_and_values)
  try:
    with tf.io.gfile.GFile(best_checkpoint_path, 'w') as fout:
      fout.write(checkpoint_path + '\n')
    with tf.io.gfile.GFile(best_checkpoint_metrics_path, 'w') as fout:
      json.dump(serializable, fout, sort_keys=True, indent=4)
  except:  # pylint: disable=bare-except
    # Note we have a bare exception here as as there's no clear TF base
    # exception to catch will cover all of the potential issues that might arise
    # trying to write our metrics to our metrics file.
    logging.warning('Failed to write best checkpoint to path %s',
                    best_checkpoint_path)
Writes files containing best checkpoint path and best checkpoint metrics.

  Args:
    checkpoint_path: str; a path to the best checkpoint.
    metrics_and_values: dict[string,object]; a dictionary of key/value pairs
      containing metrics for the best checkpoint we have seen. These will be
      converted to a JSON of key/string pairs and written out to disk.
    eval_name: str; the name of the eval run, which is used to derive the
      subdirectory of checkpoint_path where the eval metrics will be written.
  
Writes files containing best checkpoint path and best checkpoint metrics.
Writes files containing best checkpoint path and best checkpoint metrics .
def _write_best_checkpoint(checkpoint_path, metrics_and_values, eval_name):
  best_checkpoint_path = checkpoint_metrics_path(
      checkpoint_path, eval_name, file_name='best_checkpoint.txt')
  best_checkpoint_metrics_path = checkpoint_metrics_path(
      checkpoint_path, eval_name, file_name='best_checkpoint.metrics')
  serializable = {k: str(v) for k, v in metrics_and_values.items()}
  logging.info('Writing new best checkpoint %s with values %s',
               best_checkpoint_path, metrics_and_values)
  try:
    with tf.io.gfile.GFile(best_checkpoint_path, 'w') as fout:
      fout.write(checkpoint_path + '\n')
    with tf.io.gfile.GFile(best_checkpoint_metrics_path, 'w') as fout:
      json.dump(serializable, fout, sort_keys=True, indent=4)
  except:  
    logging.warning('Failed to write best checkpoint to path %s',
                    best_checkpoint_path)
def _write_best_checkpoint ( checkpoint_path , metrics_and_values , eval_name ) : best_checkpoint_path = checkpoint_metrics_path ( checkpoint_path , eval_name , file_name = 'best_checkpoint.txt' ) best_checkpoint_metrics_path = checkpoint_metrics_path ( checkpoint_path , eval_name , file_name = 'best_checkpoint.metrics' ) serializable = { k : str ( v ) for k , v in metrics_and_values . items ( ) } logging . info ( 'Writing new best checkpoint %s with values %s' , best_checkpoint_path , metrics_and_values ) try : with tf . io . gfile . GFile ( best_checkpoint_path , 'w' ) as fout : fout . write ( checkpoint_path + '\n' ) with tf . io . gfile . GFile ( best_checkpoint_metrics_path , 'w' ) as fout : json . dump ( serializable , fout , sort_keys = True , indent = 4 ) except : logging . warning ( 'Failed to write best checkpoint to path %s' , best_checkpoint_path )
Writes files containing best checkpoint path and best checkpoint metrics.
Writes files containing best checkpoint path and best checkpoint metrics .
"""Writes files containing best checkpoint path and best checkpoint metrics.

  Args:
    checkpoint_path: str; a path to the best checkpoint.
    metrics_and_values: dict[string,object]; a dictionary of key/value pairs
      containing metrics for the best checkpoint we have seen. These will be
      converted to a JSON of key/string pairs and written out to disk.
    eval_name: str; the name of the eval run, which is used to derive the
      subdirectory of checkpoint_path where the eval metrics will be written.
  """ # pylint: disable=bare-except # Note we have a bare exception here as as there's no clear TF base # exception to catch will cover all of the potential issues that might arise # trying to write our metrics to our metrics file.
checkpoint_path
str; a path to the best checkpoint.
str ; a path to the best checkpoint .
metrics_and_values
dict[string,object]; a dictionary of key/value pairs
containing metrics for the best checkpoint we have seen. These will be
converted to a JSON of key/string pairs and written out to disk.
dict [ string object ] ; a dictionary of key / value pairs containing metrics for the best checkpoint we have seen . These will be converted to a JSON of key / string pairs and written out to disk .
eval_name
str; the name of the eval run, which is used to derive the
subdirectory of checkpoint_path where the eval metrics will be written.
str ; the name of the eval run which is used to derive the subdirectory of checkpoint_path where the eval metrics will be written .