File size: 568 Bytes
0e55bc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import AutoModelForTokenClassification, AutoTokenizer
from helpers import helper
MODEL_NAME = 'boda/ANER'
# Load model and tokenizer
model = AutoModelForTokenClassification.from_pretrained('.')
tokenizer = AutoTokenizer.from_pretrained('.')
# change in the model labels
# model.config.id2label = {i: ' '+v+' ' for i, v in model.config.id2label.items() if i != 0 }
# model.config.id2label[0] = 'O'
# model.config.label2id = {label: i for i, label in model.config.id2label.items()}
# save model after finish
# model.save_pretrained('.')
|