Skip to content

Commit

Permalink
update readme and make run.py
Browse files Browse the repository at this point in the history
  • Loading branch information
macanv committed May 31, 2019
1 parent fed9079 commit 86adbe4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ cd BERT-BiLSTM-CRF-NER/
python3 setup.py install
```

if you do not want to install, you just need clone this project and reference the file of <run.py> to train the model or start the service.

## UPDATE:
- 2019.2.25 Fix some bug for ner service
- 2019.2.19: add text classification service
Expand Down
28 changes: 17 additions & 11 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
from __future__ import print_function


# sys.path.append('.')


def start_server():
from bert_base.server import BertServer
from bert_base.server.helper import get_run_args
Expand All @@ -27,15 +24,24 @@ def start_server():
server.join()


def start_client():
pass
def train_ner():
import os
from bert_base.train.train_helper import get_args_parser
from bert_base.train.bert_lstm_ner import train


# def train_ner():
# from bert_lstm_ner import main
# args =
# main()
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__':
start_server()
"""
如果想训练,那么直接 指定参数跑,如果想启动服务,那么注释掉train,打开server即可
"""
train_ner()
#start_server()

0 comments on commit 86adbe4

Please sign in to comment.