-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_ner.py
32 lines (25 loc) · 828 Bytes
/
run_ner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
运行 BERT NER Server
#@Time : 2019/1/26 21:00
# @Author : MaCan (ma_cancan@163.com)
# @File : run_ner.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def train_ner():
import os
from bert_base.train.train_helper import get_args_parser
from bert_base.train.bert_lstm_ner import train
args = get_args_parser()
if True:
import sys
param_str = '\n'.join(['%20s = %s' % (k, v) for k, v in sorted(vars(args).items())])
print('usage: %s\n%20s %s\n%s\n%s\n' % (' '.join(sys.argv), 'ARG', 'VALUE', '_' * 50, param_str))
print(args)
os.environ['CUDA_VISIBLE_DEVICES'] = args.device_map
train(args=args)
if __name__ == '__main__':
train_ner()