Tensorflow and Keras Implementation of the state of the art researches in Dialog System NLU. Tested on Tensorflow version 1.15.0
- Data format as in the paper
Slot-Gated Modeling for Joint Slot Filling and Intent Prediction
(Goo et al):- Consists of 3 files:
seq.in
file contains text samples (utterances)seq.out
file contains tags corresponding to samples fromseq.in
label
file contains intent labels corresponding to samples fromseq.in
- Consists of 3 files:
- Snips Dataset (
Snips voice platform: an embedded spoken language understanding system for private- by-design voice interfaces
)(Coucke et al., 2018), which is collected from the Snips personal voice assistant.- The training, development and test sets contain 13,084, 700 and 700 utterances, respectively.
- There are 72 slot labels and 7 intent types for the training set.
4 models implemented joint_bert
and joint_bert_crf
each supports bert
and albert
--train
or-t
Path to training data in Goo et al format.--val
or-v
Path to validation data in Goo et al format.--save
or-s
Folder path to save the trained model.
--epochs
or-e
Number of epochs.--batch
or-bs
Batch size.--type
or-tp
to choose betweenbert
andalbert
. Default isbert
python train_joint_bert.py --train=data/snips/train --val=data/snips/valid --save=saved_models/joint_bert_model --epochs=5 --batch=64 --type=bert
python train_joint_bert.py --train=data/snips/train --val=data/snips/valid --save=saved_models/joint_albert_model --epochs=5 --batch=64 --type=albert
python train_joint_bert_crf.py --train=data/snips/train --val=data/snips/valid --save=saved_models/joint_bert_crf_model --epochs=5 --batch=32 --type=bert
python train_joint_bert_crf.py --train=data/snips/train --val=data/snips/valid --save=saved_models/joint_albert_crf_model --epochs=5 --batch=32 --type=albert
--model
or-m
Path to joint BERT / ALBERT NLU model.--data
or-d
Path to data in Goo et al format.
--batch
or-bs
Batch size.--type
or-tp
to choose betweenbert
andalbert
. Default isbert
python eval_joint_bert.py --model=saved_models/joint_bert_model --data=data/snips/test --batch=128 --type=bert
python eval_joint_bert.py --model=saved_models/joint_albert_model --data=data/snips/test --batch=128 --type=albert
python eval_joint_bert_crf.py --model=saved_models/joint_bert_crf_model --data=data/snips/test --batch=128 --type=bert
python eval_joint_bert_crf.py --model=saved_models/joint_albert_crf_model --data=data/snips/test --batch=128 --type=albert
--model
or-m
Path to joint BERT / ALBERT NLU model.
--type
or-tp
to choose betweenbert
andalbert
. Default isbert
python bert_nlu_basic_api.py --model=saved_models/joint_albert_model --type=albert
- POST
- Payload:
{
"utterance": "make me a reservation in south carolina"
}
{
"intent": {
"confidence": "0.9888",
"name": "BookRestaurant"
},
"slots": [
{
"slot": "state",
"value": "south carolina",
"start": 5,
"end": 6
}
]
}