示例#1
0
  hps = hps.parse(FLAGS.hpconfig)
  _copy_flags_to_hparams(hps)

  run_training_with_default_inputs(hps, train_dir, tuner, FLAGS.master,
                                   FLAGS.validation_fold_template)


def main(unused_argv):
  if (FLAGS.input_dir is None) == (FLAGS.dataset is None):
    raise ValueError('exactly one of --input_dir or --dataset required')

  invalid_input_features = set(FLAGS.input_features) - _VALID_INPUT_FEATURES
  if invalid_input_features:
    raise ValueError('invalid input_features: %r' % invalid_input_features)

  # use r=3 subdirectory to fix empty events files (see b/28535367)
  root_dir = os.path.join(FLAGS.save_base, FLAGS.run_name, 'r=3')
  gfile.MakeDirs(root_dir)

  if FLAGS.autotune:
    _train_with_autotune(root_dir)
  else:
    _train_without_autotune(root_dir)


if __name__ == '__main__':
  flags.mark_flag_as_required('save_base')
  flags.mark_flag_as_required('run_name')
  flags.mark_flag_as_required('num_fc_layers')
  app.run()
示例#2
0
            None,
            count_table,
            0,
            expected_sequence_length=FLAGS.sequence_length,
            base_qual_threshold=FLAGS.base_qual_threshold,
            bad_base_threshold=FLAGS.bad_base_threshold,
            avg_qual_threshold=FLAGS.avg_qual_threshold,
            num_reads=FLAGS.num_reads)

  # write out the statistics
  stats.fastq_read1_name = FLAGS.fastq1
  stats.fastq_read2_name = FLAGS.fastq2
  with gfile.FastGFile(FLAGS.output_name + ".statistics.pbtxt", "w") as out:
    out.write(str(stats))

  # write to an SSTable of measurement protos
  with sstable.SortingBuilder(FLAGS.output_name) as builder:
    for sequence, counts in count_table.iteritems():
      key = sequence
      proto = measurement_pb2.Measurement()
      proto.counts[FLAGS.measurement_id] = counts[0]
      builder.Add(key, proto.SerializeToString())


if __name__ == "__main__":
  # mark required flags here so unit test doesn't need the sys.argv.extend hack
  flags.mark_flag_as_required("fastq1")
  flags.mark_flag_as_required("measurement_id")

  app.run()