bert icon indicating copy to clipboard operation
bert copied to clipboard

I get error when I run classifier in task MRPC

Open quincyliang opened this issue 8 years ago • 2 comments

I pulled the latest code and run classifier with the following script python run_classifier.py
--task_name=MRPC
--do_train=true
--do_eval=true
--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=$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=$GLUE_DIR/mrpc_output/

The error message is:

INFO:tensorflow:label: 1 (id = 1) Traceback (most recent call last): File "run_classifier.py", line 895, in tf.app.run() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "run_classifier.py", line 862, in main FLAGS.max_seq_length, tokenizer, predict_file) File "run_classifier.py", line 447, in file_based_convert_examples_to_features max_seq_length, tokenizer) File "run_classifier.py", line 417, in convert_single_example label_id = label_map[example.label] KeyError: '2'

quincyliang avatar Nov 08 '18 01:11 quincyliang

Were you using the actual latest when you pulled it? I made a fix a few hours ago but it was a different error. I just tested with the latest and it works for me. Did you change your code to do eval (not predictions) on the test set? (Because that would cause this exact error).

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

I just pulled the code again, it works for me. Thanks!

quincyliang avatar Nov 08 '18 01:11 quincyliang