convert_tokens_to_ids(self, tokens)中的ids.append(self.vocab[token])，KeyError
# ❓ Questions & Help

## Details
<!-- Description of your issue -->
KeyError                                  Traceback (most recent call last)
<ipython-input-20-dfb0a32a8e67> in <module>()
     19 for mask_pos in mask_positions:
     20     candidates = options[num]
---> 21     candidates_ids = tokenizer.convert_tokens_to_ids(candidates)
     22     token_ids = tokenizer.convert_tokens_to_ids(tokenized_text)
     23     tokens_tensor = torch.tensor([token_ids])

~/anaconda3/lib/python3.6/site-packages/pytorch_pretrained_bert/tokenization.py in convert_tokens_to_ids(self, tokens)
    119         ids = []
    120         for token in tokens:
--> 121             ids.append(self.vocab[token])
    122         if len(ids) > self.max_len:
    123             logger.warning(

KeyError: 'persuading'

How to solve KeyError problems?Thank you.
The token that you are trying to convert to ids doesn't exist. 'persuading' is a long word, so it's likely that it is not as such present in the vocab. Instead you'll have to tokenize it first into subword units.<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
