From 5e10be4cd23468946a66aba31ef0e2ef77b21331 Mon Sep 17 00:00:00 2001 From: Abhishek Rao Date: Mon, 5 Nov 2018 13:34:49 -0800 Subject: [PATCH] Add info about predict mode --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index fb77b6e..26fc385 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,27 @@ use BERT for any single-sentence or sentence-pair classification task. Note: You might see a message `Running train on CPU`. This really just means that it's running on something other than a Cloud TPU, which includes a GPU. +#### Prediction from classifier +Once you have trained your classifier you can use it in inference mode by using the --do_predict=true command. +You need to have a file named predict.tsv in the input folder. +Output will be created in file called predict_results.tsv in the output folder. +Each line will contain output for each sample, columns are the class probabilities. +```shell +export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12 +export GLUE_DIR=/path/to/glue +export TRAINED_CLASSIFIER=/path/to/fine/tuned/classifier + +python run_classifier.py \ + --task_name=MRPC \ + --do_predict=true \ + --data_dir=$GLUE_DIR/MRPC \ + --vocab_file=$BERT_BASE_DIR/vocab.txt \ + --bert_config_file=$BERT_BASE_DIR/bert_config.json \ + --init_checkpoint=$TRAINED_CLASSIFIER \ + --max_seq_length=128 \ + --output_dir=/tmp/mrpc_output/ +``` + ### SQuAD The Stanford Question Answering Dataset (SQuAD) is a popular question answering -- GitLab