MCPcopy Create free account
hub / github.com/google-research/language / main

Function main

language/capwap/preprocessing/weakly_supervised.py:98–121  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

96
97
98def main(argv):
99 if len(argv) > 1:
100 raise app.UsageError("Too many command-line arguments.")
101
102 tf.logging.set_verbosity(tf.logging.INFO)
103 if not FLAGS.output_dir:
104 FLAGS.output_dir = os.path.dirname(FLAGS.generation_file)
105 tf.io.gfile.makedirs(FLAGS.output_dir)
106
107 # Load generations.
108 vocab = text_utils.Vocab.load(FLAGS.vocab_path)
109 captions = load_synthetic_captions(FLAGS.generation_file, vocab)
110 images = []
111 for image_id, captions in captions.items():
112 metadata = image_utils.ImageMetadata(
113 image_id=image_id, captions=captions, objects=FLAGS.features)
114 images.append(metadata)
115
116 # Dump to sharded TFRecords.
117 io_utils.convert_to_tfrecords(
118 dataset=images,
119 num_shards=FLAGS.num_shards,
120 basename=os.path.join(FLAGS.output_dir, "train"),
121 example_fn=io_utils.caption_example)
122
123
124if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

load_synthetic_captionsFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…