-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevaluate.py
More file actions
21 lines (15 loc) · 924 Bytes
/
evaluate.py
File metadata and controls
21 lines (15 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from run import Runner
import sys
def evaluate(config_name, gpu_id, saved_suffix, out_file):
runner = Runner(config_name, gpu_id)
model = runner.initialize_model(saved_suffix)
#model.eval_only = True
examples_train, examples_dev, examples_test = runner.data.get_tensor_examples()
stored_info = runner.data.get_stored_info()
#runner.evaluate(model, examples_dev, stored_info, 0, official=True, conll_path=runner.config['conll_eval_path'], out_file=out_file) # Eval dev
# print('=================================')
runner.evaluate(model, examples_test, stored_info, 0, official=True, conll_path=runner.config['conll_test_path'], out_file=out_file) # Eval test
if __name__ == '__main__':
config_name, saved_suffix, gpu_id = sys.argv[1], sys.argv[2], int(sys.argv[3])
out_file = sys.argv[4] if len(sys.argv) > 4 else None
evaluate(config_name, gpu_id, saved_suffix, out_file)