def do_evaluate(args): config = Config(args.model_path) helper = ModelHelper.load(args.model_path) input_data = read_conll(args.data) embeddings = load_embeddings(args, helper) config.embed_size = embeddings.shape[1] logger.info("Building model...", ) start = time.time() model = WindowModel(helper, config, embeddings) logger.info("took %.2f seconds", time.time() - start) for sentence, labels, predictions in model.output(input_data): predictions = [LBLS[l] for l in predictions] print_sentence(args.output, sentence, labels, predictions)
def do_evaluate(args): config = Config(args.model_path) helper = ModelHelper.load(args.model_path) input_data = read_conll(args.data) embeddings = load_embeddings(args, helper) config.embed_size = embeddings.shape[1] with tf.Graph().as_default(): logger.info("Building model...",) start = time.time() model = WindowModel(helper, config, embeddings) logger.info("took %.2f seconds", time.time() - start) init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: session.run(init) saver.restore(session, model.config.model_output) for sentence, labels, predictions in model.output(session, input_data): predictions = [LBLS[l] for l in predictions] print_sentence(args.output, sentence, labels, predictions)
def do_evaluate(args): config = Config(args.model_path) helper = ModelHelper.load(args.model_path) input_data = read_conll(args.data) embeddings = load_embeddings(args, helper) config.embed_size = embeddings.shape[1] with tf.Graph().as_default(): logger.info("Building model...", ) start = time.time() model = WindowModel(helper, config, embeddings) logger.info("took %.2f seconds", time.time() - start) init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: session.run(init) saver.restore(session, model.config.model_output) for sentence, labels, predictions in model.output(session, input_data): predictions = [LBLS[l] for l in predictions] print_sentence(args.output, sentence, labels, predictions)