BERT-NER icon indicating copy to clipboard operation
BERT-NER copied to clipboard

How can i make fine tuning with new entities/labels?

Open matteopulega opened this issue 5 years ago • 1 comments

Hi, i would like to fine tune the bert model with my own labels, like [COLOR, MATERIAL] and not the normal "NAME", "ORG". I'm following this Colab: https://colab.research.google.com/drive/14rYdqGAXJhwVzslXT4XIwNFBwkmBWdVV

I prepared train.txt, eval.txt, test.txt like this:

-DOCSTART- -X- -X- O

blue B-COLOR motorcicle B-CATEGORY steel B-MATERIAL etc.

But whene i execute this command !python run_ner.py --data_dir=data/ --bert_model=bert-base-multilingual-cased --task_name=ner --output_dir=out_ner --max_seq_length=128 --do_train --num_train_epochs 5 --do_eval --warmup_proportion=0.1

i get this error ` File "run_ner.py", line 594, in main()

File "run_ner.py", line 464, in main train_examples, label_list, args.max_seq_length, tokenizer)

File "run_ner.py", line 210, in convert_examples_to_features label_ids.append(label_map[labels[i]])

KeyError: 'B-COLOR' `

matteopulega avatar Jun 08 '20 12:06 matteopulega

Did you change the labels in get_labels() method?

Syauri avatar Sep 03 '20 13:09 Syauri