Exemplo n.º 1
0
def export(checkpoint, destination, use_tf_sampling):
    model = None
    if use_tf_sampling:
        model = lib_tfsampling.CoconetSampleGraph(checkpoint)
        model.instantiate_sess_and_restore_checkpoint()
    else:
        model = lib_graph.load_checkpoint(checkpoint)
    tf.logging.info('Loaded graph.')
    lib_saved_model.export_saved_model(model, destination,
                                       [tf.saved_model.tag_constants.SERVING],
                                       use_tf_sampling)
Exemplo n.º 2
0
def export(checkpoint, destination, use_tf_sampling):
  model = None
  if use_tf_sampling:
    model = lib_tfsampling.CoconetSampleGraph(checkpoint)
    model.instantiate_sess_and_restore_checkpoint()
  else:
    model = lib_graph.load_checkpoint(checkpoint)
  tf.logging.info('Loaded graph.')
  lib_saved_model.export_saved_model(model, destination,
                                     [tf.saved_model.tag_constants.SERVING],
                                     use_tf_sampling)
Exemplo n.º 3
0
def main(unused_argv):
    if FLAGS.checkpoint is None or not FLAGS.checkpoint:
        raise ValueError('Need to provide a path to checkpoint directory.')
    if FLAGS.destination is None or not FLAGS.destination:
        raise ValueError(
            'Need to provide a destination directory for the SavedModel.')
    model = None
    if FLAGS.use_tf_sampling:
        model = lib_tfsampling.CoconetSampleGraph(FLAGS.checkpoint)
        model.instantiate_sess_and_restore_checkpoint()
    else:
        model = lib_graph.load_checkpoint(FLAGS.checkpoint)
    tf.logging.info('Loaded graph.')
    lib_saved_model.export_saved_model(model, FLAGS.destination,
                                       [tf.saved_model.tag_constants.SERVING],
                                       FLAGS.use_tf_sampling)
    tf.logging.info('Exported SavedModel to %s.', FLAGS.destination)