Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matteopulega opened this issue Jun 8, 2020 · 1 comment
Open

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

matteopulega opened this issue Jun 8, 2020 · 1 comment

Comments

@matteopulega
Copy link

matteopulega commented Jun 8, 2020

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'
`

@Syauri
Copy link

Syauri commented Sep 3, 2020

Did you change the labels in get_labels() method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants