def main(args): if args.generate_submission: generate_submission(args) else: trainer = AppTrainer(args, ner_labels) if args.do_eda: show_ner_datainfo(ner_labels, train_data_generator, args.train_file, test_data_generator, args.test_file) elif args.do_train: train_examples, val_examples = load_train_val_examples(args) trainer.train(args, train_examples, val_examples) elif args.do_eval: _, eval_examples = load_train_val_examples(args) model = load_model(args) trainer.evaluate(args, model, eval_examples) elif args.do_predict: test_examples = load_test_examples(args) model = load_model(args) trainer.predict(args, model, test_examples) save_ner_preds(args, trainer.pred_results, test_examples)
def do_predict(args): args.model_path = args.best_model_path test_examples = load_test_examples(args) model = load_model(args) trainer.predict(args, model, test_examples) reviews_file, category_mentions_file = save_ner_preds( args, trainer.pred_results, test_examples) return reviews_file, category_mentions_file
def do_predict(args): args.model_path = args.best_model_path test_examples = load_test_examples(args) model = load_model(args) trainer.predict(args, model, test_examples) save_ner_preds(args, trainer.pred_results, test_examples)