Bert: prediction from classifier

Created on 1 Dec 2018  路  6Comments  路  Source: google-research/bert

I have 2 questions.

  1. To make a prediction with a trained classifier, the README instructions say you need to have a file named test.tsv in the input folder. What is the input folder and how do I specify it in the call to make a prediction below?

python run_classifier.py
--task_name=COLA
--do_predict=true
--data_dir=$GLUE_DIR/CoLA
--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/cola_output/

  1. Also, what is the path to the trained classifier? Does the export look something like the following?

export TRAINED_CLASSIFIER = /tmp/cola_output/model.ckpt-1603

i.e. is the path to the trained classifier the path to the latest model checkpoint?

Most helpful comment

I figured out the answer to my question #2 above. The weights of the trained classifier will be in the output_dir directory you specified as a parameter when your trained the classifier.

So in my example above, the weights of the trained classifier were saved to
--output_dir=/tmp/cola_output/

Look in that folder to see what the highest numbered model.ckpt file is and then set TRAINED_CLASSIFIER to something like:

export TRAINED_CLASSIFIER = /tmp/cola_output/model.ckpt-1603

All 6 comments

--data_dir=$GLUE_DIR/CoLA is the input folder

thank you HaodaY

i have the same question to ask, there is not the specific path of TRAINED_CLASSIFIER in the README instructions, have u alreadly pointed out the question?

I figured out the answer to my question #2 above. The weights of the trained classifier will be in the output_dir directory you specified as a parameter when your trained the classifier.

So in my example above, the weights of the trained classifier were saved to
--output_dir=/tmp/cola_output/

Look in that folder to see what the highest numbered model.ckpt file is and then set TRAINED_CLASSIFIER to something like:

export TRAINED_CLASSIFIER = /tmp/cola_output/model.ckpt-1603

has anyone noticed that the output is sort of interesting? as it looks really one-sided?

@PaulZhangIsing what do you mean it looks really one-sided?

Was this page helpful?
0 / 5 - 0 ratings