bert icon indicating copy to clipboard operation
bert copied to clipboard

Training on data sets not in the discussed data sets

Open bradybray opened this issue 8 years ago • 1 comments

Would it be possible to supplant the microsoft research paraphrase data with data from an alternative source?

Take, for example, the following;

`export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12 export GLUE_DIR=/path/to/glue

python run_classifier.py
--task_name=MRPC
--do_train=true
--do_eval=true
--data_dir=$GLUE_DIR/MRPC
--vocab_file=$BERT_BASE_DIR/vocab.txt
--bert_config_file=$BERT_BASE_DIR/bert_config.json
--init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt
--max_seq_length=128
--train_batch_size=32
--learning_rate=2e-5
--num_train_epochs=3.0
--output_dir=/tmp/mrpc_output/ `

Does run_classifier support replacing the data_dir with my own dataset to train the classifier?

bradybray avatar Nov 01 '18 21:11 bradybray

It doesn't work out-of-the-box because there is a processing function called MrpcProcessor that processes the specific data format used by GLUE. You'll need to change it for your data format and to tell the model what your classification labels are.

To create your own classifier, just open up run_classifier.py and implement your own DataProcessor sub-class like MrpcProcessor, ColaProcessor, or MnliProcessor, (or, if your problem is formulated differently, use run_classifier.py as a guide and adapt it to your need), then add it to this part of run_classifier.py:

  processors = {
      "cola": ColaProcessor,
      "mnli": MnliProcessor,
      "mrpc": MrpcProcessor,
  }

jacobdevlin-google avatar Nov 01 '18 21:11 jacobdevlin-google