@Narsil Thanks for the reply.
I think I may have misled you.  The problems happened AFTER I used run_mlm.py 3. The script I used is like this:
output_dir="../embeddings/roberta-chinese/"
CUDA_VISIBLE_DEVICES=0 python ../run_mlm.py \
    --output_dir=$output_dir \
    --model_type=roberta \
    --do_train \
    --tokenizer_name=$output_dir \
    --config_name=$output_dir \
    --train_file=$train_file \
    --do_eval \
    --validation_file=$validation_file  \
    --line_by_line \
    --overwrite_output_dir \
    --max_steps=$max_steps

In the ../embeddings/roberta-chinese/, there is a config file which looks like this:
  "_name_or_path": "roberta-base",
  "architectures": [
    "RobertaModel"
  ],
  "attention_probs_dropout_prob": 0.1,
  "bos_token_id": 0,
  "eos_token_id": 2,
  "gradient_checkpointing": false,
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.1,
  "hidden_size": 768,
  "initializer_range": 0.02,
  "intermediate_size": 3072,
  "layer_norm_eps": 1e-05,
  "max_position_embeddings": 514,
  "model_type": "roberta",
  "num_attention_heads": 12,
  "num_hidden_layers": 12,
  "pad_token_id": 1,
  "type_vocab_size": 1,
  "vocab_size": 30000
}

After training, I used the huggingface AutoTokenizer to load the trained model and tokenizer:
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('../embeddings/roberta-chinese')

encode_dict = tokenizer('这是 一个 测试')
print(encode_dict)  #{'input_ids': [0, 2], 'attention_mask': [1, 1]}

I do not understand the problem because I used the BERT (and WordPiece class in Tokenizer) model exactly the same way and it works fine.