ai-forever / ner-bert

BERT-NER (nert-bert) with google bert https://github.com/google-research.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prev_label = "" Error

chzuo opened this issue · comments

commented

Hi,

I got an error when I run

data = NerData.create(train_path, valid_path, vocab_file)

~/Downloads/ner-bert-master/modules/data/bert_data.py in get_data(df, tokenizer, label2idx, max_seq_len, pad, cls2idx, is_cls, is_meta)
189 if label != "O":
190 label = label.split("")[1]
--> 191 if label == prev_label:
192 prefix = "I
"
193 prev_label = label

UnboundLocalError: local variable 'prev_label' referenced before assignment

And if I cancel the comment in line 187: prev_label ="", it turns out missing the 'I_O 'label

Thanks, Fix in your code locally, plz :(.