enable per model choice of training epoch;make config file exchangeable

pull/2/head
Kai Labusch 5 years ago
parent 54edcbc44d
commit a5e5af2196

@ -18,7 +18,7 @@ from pytorch_pretrained_bert.modeling import (CONFIG_NAME,
app = Flask(__name__) app = Flask(__name__)
app.config.from_json('config.json') app.config.from_json('config.json' if not os.environ.get('CONFIG') else os.environ.get('CONFIG'))
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -161,7 +161,7 @@ class PredictorStore:
if self._model_id != model_id: if self._model_id != model_id:
self._predictor = NERPredictor(model_dir=model['model_dir'], self._predictor = NERPredictor(model_dir=model['model_dir'],
epoch=app.config['EPOCH'], epoch=model['epoch'],
batch_size=app.config['BATCH_SIZE'], batch_size=app.config['BATCH_SIZE'],
no_cuda=False if not os.environ.get('USE_CUDA') else no_cuda=False if not os.environ.get('USE_CUDA') else
os.environ.get('USE_CUDA').lower() == 'false') os.environ.get('USE_CUDA').lower() == 'false')

@ -1,30 +1,33 @@
{ {
"DATA_PATH": "data/digisam/fulltext.sqlite3", "DATA_PATH": "data/digisam/fulltext.sqlite3",
"EPOCH": 7,
"BATCH_SIZE": 256, "BATCH_SIZE": 256,
"MODELS": [ "MODELS": [
{ {
"name": "DC-SBB + CONLL + GERMEVAL", "name": "DC-SBB + CONLL + GERMEVAL",
"id": 1, "id": 1,
"model_dir": "data/konvens2019/build-wd_0.03/bert-all-german-de-finetuned", "model_dir": "data/konvens2019/build-wd_0.03/bert-all-german-de-finetuned",
"epoch": 7,
"default": true "default": true
}, },
{ {
"name": "DC-SBB + CONLL + GERMEVAL + SBB", "name": "DC-SBB + CONLL + GERMEVAL + SBB",
"id": 2, "id": 2,
"model_dir": "data/konvens2019/build-on-all-german-de-finetuned/bert-sbb-de-finetuned", "model_dir": "data/konvens2019/build-on-all-german-de-finetuned/bert-sbb-de-finetuned",
"epoch": 7,
"default": false "default": false
}, },
{ {
"name": "DC-SBB + SBB", "name": "DC-SBB + SBB",
"id": 3, "id": 3,
"model_dir": "data/konvens2019/build-wd_0.03/bert-sbb-de-finetuned", "model_dir": "data/konvens2019/build-wd_0.03/bert-sbb-de-finetuned",
"epoch": 7,
"default": false "default": false
}, },
{ {
"name": "CONLL + GERMEVAL", "name": "CONLL + GERMEVAL",
"id": 4, "id": 4,
"model_dir": "data/konvens2019/build-wd_0.03/bert-all-german-baseline", "model_dir": "data/konvens2019/build-wd_0.03/bert-all-german-baseline",
"epoch": 7,
"default": false "default": false
} }
], ],

Loading…
Cancel
Save