bert icon indicating copy to clipboard operation
bert copied to clipboard

Key Error on Sentence Classification example

Open xikunlun001 opened this issue 8 years ago • 8 comments

I was trying to run the sentence classification example step by step but there is a keyerror happened at very beginning as following:

INFO:tensorflow:Writing example 0 of 3669 Traceback (most recent call last): File "run_classifier.py", line 908, in tf.app.run() File "/home/guyang/anaconda2/envs/BERT/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "run_classifier.py", line 824, in main train_examples, label_list, FLAGS.max_seq_length, tokenizer, train_file) File "run_classifier.py", line 458, in file_based_convert_examples_to_features max_seq_length, tokenizer) File "run_classifier.py", line 428, in convert_single_example label_id = label_map[example.label] KeyError: '\ufeffQuality'

xikunlun001 avatar Nov 08 '18 00:11 xikunlun001

Oops, I introduced a bug this morning. I just fixed it now.

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

@jacobdevlin-google thanks

xikunlun001 avatar Nov 08 '18 00:11 xikunlun001

@jacobdevlin-google thanks

so how did u solve it in the end??

PaulZhangIsing avatar Jan 09 '19 02:01 PaulZhangIsing

Oops, I introduced a bug this morning. I just fixed it now.

I have pulled the lastest version (i.e. 21 days ago with self-written processors,)seems this kind of error happens again

PaulZhangIsing avatar Jan 09 '19 03:01 PaulZhangIsing

Seems there is some bug on line 489 of run_classifier.py. I added a tab before features and everything is fine

PaulZhangIsing avatar Jan 09 '19 03:01 PaulZhangIsing

I've tried adding the tab at line 489 but it doesn't fix the error, any suggestions? thanks :)

Danysolism avatar Feb 05 '19 16:02 Danysolism

well, this tab does not help. could u show your data and data processor??

I've tried adding the tab at line 489 but it doesn't fix the error, any suggestions? thanks :)

PaulZhangIsing avatar Feb 21 '19 01:02 PaulZhangIsing

You need to hide the row index from your data frame in time of saving to tsv. It could be df.to_csv('train.tsv', sep='\t', index=False, header=False)

delgadoliveira avatar May 08 '19 17:05 delgadoliveira