Train | |
Before you start training your model, create a map of the expected ids to their labels with id2label and label2id: | |
id2label = { | |
0: "O", | |
1: "B-corporation", | |
2: "I-corporation", | |
3: "B-creative-work", | |
4: "I-creative-work", | |
5: "B-group", | |
6: "I-group", | |
7: "B-location", | |
8: "I-location", | |
9: "B-person", | |
10: "I-person", | |
11: "B-product", | |
12: "I-product", | |
} | |
label2id = { | |
"O": 0, | |
"B-corporation": 1, | |
"I-corporation": 2, | |
"B-creative-work": 3, | |
"I-creative-work": 4, | |
"B-group": 5, | |
"I-group": 6, | |
"B-location": 7, | |
"I-location": 8, | |
"B-person": 9, | |
"I-person": 10, | |
"B-product": 11, | |
"I-product": 12, | |
} | |
If you aren't familiar with finetuning a model with the [Trainer], take a look at the basic tutorial here! |