c3sr/split-ner

KeyError

Closed this issue · 0 comments

Hi, I'm a novice in deep learning, sorry if it is a silly question. I trained the Span Detection Module with the command python main_qa.py ../config/dummy/spandetect.json and when it was running dataset.py line653 batch_text = [entry[self.args.token_type] for entry in features] it came up with the error KeyError: 'sub_text'. I debugged and found entry was a list of tensor instead of a dictionary, but token_type is a string which defaults to 'sub_text'. How shell I deal with this error?

# char_ids
        if self.args.use_char_cnn in ["char", "both"]:
            batch_text = [entry[self.args.token_type] for entry in features]
            char_vocab = NerDataset.get_char_vocab()
            batch["char_ids"] = NerDataset.get_char_ids(batch_text, max_len, char_vocab)