def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) if not FLAGS.logdir: logging.error('A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') return -1 if FLAGS.debug: logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) multiplexer = event_multiplexer.AutoloadingMultiplexer( path_to_run=path_to_run, interval_secs=60, size_guidance=TENSORBOARD_SIZE_GUIDANCE) multiplexer.AutoUpdate(interval=30) factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error('Tried to connect to port %d, but that address is in use.', FLAGS.port) return -2 status_bar.SetupStatusBarInsideGoogle('TensorBoard', FLAGS.port) print('Starting TensorBoard on port %d' % FLAGS.port) print('(You can navigate to http://localhost:%d)' % FLAGS.port) server.serve_forever()
def main(unused_argv): logging.set_verbosity(logging.INFO) with tf.Session() as sess: feature_sizes, domain_sizes, embedding_dims, num_actions = sess.run( gen_parser_ops.feature_size(task_context=FLAGS.task_context, arg_prefix=FLAGS.arg_prefix)) with tf.Session() as sess: Eval(sess, num_actions, feature_sizes, domain_sizes, embedding_dims)
def main(unused_argv): logging.set_verbosity(logging.INFO) with tf.Session() as sess: feature_sizes, domain_sizes, embedding_dims, num_actions = sess.run( gen_parser_ops.feature_size(task_context=FLAGS.task_context, arg_prefix=FLAGS.arg_prefix)) with tf.Session() as sess: Eval(sess, num_actions, feature_sizes, domain_sizes, embedding_dims)
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info('TensorBoard is in debug mode.') if not FLAGS.logdir: logging.error( 'A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') return -1 logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) logging.info('TensorBoard path_to_run is: %s', path_to_run) multiplexer = event_multiplexer.EventMultiplexer( size_guidance=TENSORBOARD_SIZE_GUIDANCE) def _Load(): start = time.time() for (path, name) in six.iteritems(path_to_run): multiplexer.AddRunsFromDirectory(path, name) multiplexer.Reload() duration = time.time() - start logging.info('Multiplexer done loading. Load took %0.1f secs', duration) t = threading.Timer(LOAD_INTERVAL, _Load) t.daemon = True t.start() t = threading.Timer(0, _Load) t.daemon = True t.start() factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error( 'Tried to connect to port %d, but that address is in use.', FLAGS.port) return -2 try: tag = resource_loader.load_resource('tensorboard/TAG').strip() logging.info('TensorBoard is tag: %s', tag) except IOError: logging.warning('Unable to read TensorBoard tag') tag = '' status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port) print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port)) print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port)) server.serve_forever()
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info('TensorBoard is in debug mode.') if not FLAGS.logdir: logging.error('A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') return -1 logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) logging.info('TensorBoard path_to_run is: %s', path_to_run) multiplexer = event_multiplexer.EventMultiplexer( size_guidance=TENSORBOARD_SIZE_GUIDANCE) # Ensure the Multiplexer initializes in a loaded state before it adds runs # So it can handle HTTP requests while runs are loading multiplexer.Reload() def _Load(): start = time.time() for (path, name) in six.iteritems(path_to_run): multiplexer.AddRunsFromDirectory(path, name) multiplexer.Reload() duration = time.time() - start logging.info('Multiplexer done loading. Load took %0.1f secs', duration) t = threading.Timer(LOAD_INTERVAL, _Load) t.daemon = True t.start() t = threading.Timer(0, _Load) t.daemon = True t.start() factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error('Tried to connect to port %d, but that address is in use.', FLAGS.port) return -2 try: tag = resource_loader.load_resource('tensorboard/TAG').strip() logging.info('TensorBoard is tag: %s', tag) except IOError: logging.warning('Unable to read TensorBoard tag') tag = '' status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port) print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port)) print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port)) server.serve_forever()
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info('TensorBoard is in debug mode.') if not FLAGS.logdir: msg = ('A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') logging.error(msg) print(msg) return -1 logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = server.ParseEventFilesSpec(FLAGS.logdir) logging.info('TensorBoard path_to_run is: %s', path_to_run) multiplexer = event_multiplexer.EventMultiplexer( size_guidance=server.TENSORBOARD_SIZE_GUIDANCE, purge_orphaned_data=FLAGS.purge_orphaned_data) server.StartMultiplexerReloadingThread(multiplexer, path_to_run, FLAGS.reload_interval) try: tb_server = server.BuildServer(multiplexer, FLAGS.host, FLAGS.port) except socket.error: if FLAGS.port == 0: msg = 'Unable to find any open ports.' logging.error(msg) print(msg) return -2 else: msg = 'Tried to connect to port %d, but address is in use.' % FLAGS.port logging.error(msg) print(msg) return -3 try: tag = resource_loader.load_resource('tensorboard/TAG').strip() logging.info('TensorBoard is tag: %s', tag) except IOError: logging.warning('Unable to read TensorBoard tag') tag = '' status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port) print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port)) print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port)) tb_server.serve_forever()
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info('TensorBoard is in debug mode.') if not FLAGS.logdir: msg = ('A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') logging.error(msg) print(msg) return -1 logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = server.ParseEventFilesSpec(FLAGS.logdir) logging.info('TensorBoard path_to_run is: %s', path_to_run) multiplexer = event_multiplexer.EventMultiplexer( size_guidance=server.TENSORBOARD_SIZE_GUIDANCE, purge_orphaned_data=FLAGS.purge_orphaned_data) server.StartMultiplexerReloadingThread(multiplexer, path_to_run, FLAGS.reload_interval) try: tb_server = server.BuildServer(multiplexer, FLAGS.host, FLAGS.port) except socket.error: if FLAGS.port == 0: msg = 'Unable to find any open ports.' logging.error(msg) print(msg) return -2 else: msg = 'Tried to connect to port %d, but address is in use.' % FLAGS.port logging.error(msg) print(msg) return -3 try: tag = resource_loader.load_resource('tensorboard/TAG').strip() logging.info('TensorBoard is tag: %s', tag) except IOError: logging.warning('Unable to read TensorBoard tag') tag = '' status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port) print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port)) print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port)) tb_server.serve_forever()
def main(unused_argv): logging.set_verbosity(logging.INFO) if not gfile.IsDirectory(OutputPath('')): gfile.MakeDirs(OutputPath('')) # Rewrite context. RewriteContext() # Creates necessary term maps. if FLAGS.compute_lexicon: logging.info('Computing lexicon...') with tf.Session(FLAGS.tf_master) as sess: gen_parser_ops.lexicon_builder(task_context=OutputPath('context'), corpus_name=FLAGS.training_corpus).run() with tf.Session(FLAGS.tf_master) as sess: feature_sizes, domain_sizes, embedding_dims, num_actions = sess.run( gen_parser_ops.feature_size(task_context=OutputPath('context'), arg_prefix=FLAGS.arg_prefix)) # Well formed and projectivize. if FLAGS.projectivize_training_set: logging.info('Preprocessing...') with tf.Session(FLAGS.tf_master) as sess: source, last = gen_parser_ops.document_source( task_context=OutputPath('context'), batch_size=FLAGS.batch_size, corpus_name=FLAGS.training_corpus) sink = gen_parser_ops.document_sink( task_context=OutputPath('context'), corpus_name='projectivized-training-corpus', documents=gen_parser_ops.projectivize_filter( gen_parser_ops.well_formed_filter(source, task_context=OutputPath( 'context')), task_context=OutputPath('context'))) while True: tf_last, _ = sess.run([last, sink]) if tf_last: break logging.info('Training...') with tf.Session(FLAGS.tf_master) as sess: Train(sess, num_actions, feature_sizes, domain_sizes, embedding_dims)
def main(unused_argv): logging.set_verbosity(logging.INFO) if not gfile.IsDirectory(OutputPath('')): gfile.MakeDirs(OutputPath('')) # Rewrite context. RewriteContext() # Creates necessary term maps. if FLAGS.compute_lexicon: logging.info('Computing lexicon...') with tf.Session(FLAGS.tf_master) as sess: gen_parser_ops.lexicon_builder( task_context=OutputPath('context'), corpus_name=FLAGS.training_corpus).run() with tf.Session(FLAGS.tf_master) as sess: feature_sizes, domain_sizes, embedding_dims, num_actions = sess.run( gen_parser_ops.feature_size(task_context=OutputPath('context'), arg_prefix=FLAGS.arg_prefix)) # Well formed and projectivize. if FLAGS.projectivize_training_set: logging.info('Preprocessing...') with tf.Session(FLAGS.tf_master) as sess: source, last = gen_parser_ops.document_source( task_context=OutputPath('context'), batch_size=FLAGS.batch_size, corpus_name=FLAGS.training_corpus) sink = gen_parser_ops.document_sink( task_context=OutputPath('context'), corpus_name='projectivized-training-corpus', documents=gen_parser_ops.projectivize_filter( gen_parser_ops.well_formed_filter( source, task_context=OutputPath('context')), task_context=OutputPath('context'))) while True: tf_last, _ = sess.run([last, sink]) if tf_last: break logging.info('Training...') with tf.Session(FLAGS.tf_master) as sess: Train(sess, num_actions, feature_sizes, domain_sizes, embedding_dims)
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info('TensorBoard is in debug mode.') if not FLAGS.logdir: logging.error( 'A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') return -1 if FLAGS.debug: logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) multiplexer = event_multiplexer.AutoloadingMultiplexer( path_to_run=path_to_run, interval_secs=60, size_guidance=TENSORBOARD_SIZE_GUIDANCE) multiplexer.AutoUpdate(interval=30) factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error( 'Tried to connect to port %d, but that address is in use.', FLAGS.port) return -2 try: tag = resource_loader.load_resource('tensorboard/TAG').strip() logging.info('TensorBoard is tag: %s', tag) except IOError: logging.warning('Unable to read TensorBoard tag') tag = '' status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port) print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port)) print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port)) server.serve_forever()
def main(unused_argv): logging.set_verbosity(logging.INFO) with tf.Session() as sess: src = gen_parser_ops.document_source(batch_size=32, corpus_name=FLAGS.corpus_name, task_context=FLAGS.task_context) sentence = sentence_pb2.Sentence() while True: documents, finished = sess.run(src) logging.info('Read %d documents', len(documents)) for d in documents: sentence.ParseFromString(d) tr = asciitree.LeftAligned() d = to_dict(sentence) print 'Input: %s' % sentence.text print 'Parse:' print tr(d) if finished: break
def main(unused_argv): logging.set_verbosity(logging.INFO) with tf.Session() as sess: src = gen_parser_ops.document_source(batch_size=32, corpus_name=FLAGS.corpus_name, task_context=FLAGS.task_context) sentence = sentence_pb2.Sentence() while True: documents, finished = sess.run(src) logging.info('Read %d documents', len(documents)) for d in documents: sentence.ParseFromString(d) tr = asciitree.LeftAligned() d = to_dict(sentence) print 'Input: %s' % sentence.text print 'Parse:' print tr(d) if finished: break
def main(unused_argv=None): # Change current working directory to tensorflow/'s parent directory. server_root = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) os.chdir(server_root) if FLAGS.debug: logging.set_verbosity(logging.DEBUG) if not FLAGS.logdir: logging.error( 'A logdir must be specified. Run `tensorboard --help` for ' 'details and examples.') return -1 if FLAGS.debug: logging.info('Starting TensorBoard in directory %s', os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) multiplexer = event_multiplexer.AutoloadingMultiplexer( path_to_run=path_to_run, interval_secs=60, size_guidance=TENSORBOARD_SIZE_GUIDANCE) multiplexer.AutoUpdate(interval=30) factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error( 'Tried to connect to port %d, but that address is in use.', FLAGS.port) return -2 status_bar.SetupStatusBarInsideGoogle('TensorBoard', FLAGS.port) print('Starting TensorBoard on port %d' % FLAGS.port) print('(You can navigate to http://localhost:%d)' % FLAGS.port) server.serve_forever()
def main(unused_argv=None): if FLAGS.debug: logging.set_verbosity(logging.DEBUG) logging.info("TensorBoard is in debug mode.") if not FLAGS.logdir: logging.error("A logdir must be specified. Run `tensorboard --help` for " "details and examples.") return -1 if FLAGS.debug: logging.info("Starting TensorBoard in directory %s", os.getcwd()) path_to_run = ParseEventFilesFlag(FLAGS.logdir) multiplexer = event_multiplexer.AutoloadingMultiplexer( path_to_run=path_to_run, interval_secs=60, size_guidance=TENSORBOARD_SIZE_GUIDANCE ) multiplexer.AutoUpdate(interval=30) factory = functools.partial(tensorboard_handler.TensorboardHandler, multiplexer) try: server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory) except socket.error: logging.error("Tried to connect to port %d, but that address is in use.", FLAGS.port) return -2 try: tag = resource_loader.load_resource("tensorboard/TAG").strip() logging.info("TensorBoard is tag: %s", tag) except IOError: logging.warning("Unable to read TensorBoard tag") tag = "" status_bar.SetupStatusBarInsideGoogle("TensorBoard %s" % tag, FLAGS.port) print("Starting TensorBoard %s on port %d" % (tag, FLAGS.port)) print("(You can navigate to http://localhost:%d)" % FLAGS.port) server.serve_forever()