text: 
  
  TITLE
  Incorrect tokenization with tokens added using tokenizer.add_tokens()
  
  COMMENTS
  2
  
  REACTIONS
  +1: 0
  -1: 0
  laugh: 0
  hooray: 0
  heart: 0
  rocket: 0
  eyes: 0
  
  BODY
  ## Environment info
  <!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
       Don't forget to fill out the missing fields in that output! -->
       
  - `transformers` version: 3.0.2
  - Platform: macOS-10.15.6-x86_64-i386-64bit
  - Python version: 3.8.3
  - PyTorch version (GPU?): 1.5.1 (False)
  - Tensorflow version (GPU?): 2.3.0 (False)
  - Using GPU in script?: No
  - Using distributed or parallel set-up in script?: No
  
  ### Who can help
  <!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
   If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
   Please tag fewer than 3 people.
   -->
  It's a tokenization issue, so tagging @mfuntowicz
  Also happens with rust tokenizers, so tagging @n1t0 
  
  ## Information
  
  Model I am using (Bert, XLNet ...): RoBERTa (but happens anywhere)
  
  The problem arises when using:
  * [ ] the official example scripts: (give details below)
  * [x] my own modified scripts: (give details below)
  
  The tasks I am working on is:
  * [x] irrelevant to the bug
  * [ ] an official GLUE/SQUaD task: (give the name)
  * [ ] my own task or dataset: (give details below)
  
  ## To reproduce
  
  Steps to reproduce the behavior:
  
  ```python
  >>> from transformers import RobertaTokenizer
  >>> tokenizer = RobertaTokenizer.from_pretrained('roberta-base')
  >>> tokenizer.add_tokens(['\U00030001', '\U00030002', '\U00030002\U00030001'])
  3
  >>> tokenizer.tokenize('\U00030002\U00030001')
  ['\U00030002\U00030001']
  >>> tokenizer.tokenize('\U00030001\U00030002\U00030001') ## produces incorrect output. the last two tokens should've been together and should not have gotten split
  ['\U00030001', '\U00030002', '\U00030001']
  >>> tokenizer.unique_no_split_tokens
  ['\U00030001', '<s>', '</s>', '<unk>', '\U00030002\U00030001', '<mask>', '<pad>', '\U00030002']
  >>> tokenizer.unique_no_split_tokens.sort(key=lambda x: -len(x)) ## On sorting the unique_no_split_tokens by the lengths, this seems to get fixed. I suspect that internally the code is checking the presence of added tokens in this order?
  >>> tokenizer.unique_no_split_tokens
  ['<mask>', '<unk>', '<pad>', '</s>', '<s>', '\U00030002\U00030001', '\U00030001', '\U00030002']
  >>> tokenizer.tokenize('\U00030001\U00030002\U00030001')
  ['\U00030001', '\U00030002\U00030001']
  ```
  
  <!-- If you have code snippets, error messages, stack traces please provide them here as well.
       Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
       Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->
  
  ## Expected behavior
  
  Tokenization seems to depend on the order in which tokens get added to the model. Just to show what happens, I've added some (very high valued) unicode character tokens and run the tokenization. 
  
  Basically, '\U00030002', '\U00030001' got split the first time, which should not have happened since ''\U00030002\U00030001' is part of the vocabulary. On sorting the tokenizer.unique_no_split_tokens list by length, it seems to fix this issue. This makes me uneasy using add_tokens now with tokens that share overlaps.
  
  Also, the problem persists with the rust tokenizers library (RobertaTokenizerFast). But I don't want to open up another issue without first making sure that this is an issue.
  
  <!-- A clear and concise description of what you would expect to happen. -->
  