| Total Complexity | 1 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/env python |
||
| 2 | from e2edutch import util |
||
| 3 | from e2edutch import coref_model as cm |
||
| 4 | |||
| 5 | import argparse |
||
| 6 | import logging |
||
| 7 | |||
| 8 | import tensorflow.compat.v1 as tf |
||
| 9 | tf.disable_v2_behavior() |
||
| 10 | |||
| 11 | |||
| 12 | def get_parser(): |
||
| 13 | parser = argparse.ArgumentParser() |
||
| 14 | parser.add_argument('config') |
||
| 15 | parser.add_argument('--cfg_file', |
||
| 16 | type=str, |
||
| 17 | default=None, |
||
| 18 | help="config file") |
||
| 19 | parser.add_argument('--model_cfg_file', |
||
| 20 | type=str, |
||
| 21 | default=None, |
||
| 22 | help="model config file") |
||
| 23 | parser.add_argument('-v', '--verbose', action='store_true') |
||
| 24 | return parser |
||
| 25 | |||
| 26 | |||
| 27 | if __name__ == "__main__": |
||
| 28 | args = get_parser().parse_args() |
||
| 29 | if args.verbose: |
||
| 30 | logging.basicConfig(level=logging.DEBUG) |
||
| 31 | config = util.initialize_from_env( |
||
| 32 | args.config, args.cfg_file, args.model_cfg_file) |
||
| 33 | model = cm.CorefModel(config) |
||
| 34 | with tf.Session() as session: |
||
| 35 | model.restore(session) |
||
| 36 | model.evaluate(session, official_stdout=True) |
||
| 37 |