How do you run transformers example scripts (e.g. with a saved model?)

I have trained BertForSequenceClassifications using one of the Huggingface-provided pretrained models (cl-tohoku/bert-base-japanese-whole-word-masking)
and now I want to train it on MLM task using

I have saved the model after the classification task:, my_model_name)

Now when I try to run

python \
    --model_name_or_path my_model_name \
    --train_file my_data.txt \
    --do_train \
    --output_dir /output_dir

it returns this error message

Traceback (most recent call last):
File “”, line 408, in
File “”, line 274, in main
config = AutoConfig.from_pretrained(model_args.model_name_or_path, **config_kwargs)
File “/home/cl/jungmin-c/.pyenv/versions/anaconda3-5.1.0/envs/jp/lib/python3.7/site-packages/transformers/models/auto/”, line 446, in from_pretrained
config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
File “/home/cl/jungmin-c/.pyenv/versions/anaconda3-5.1.0/envs/jp/lib/python3.7/site-packages/transformers/”, line 495, in get_config_dict
config_dict = cls._dict_from_json_file(resolved_config_file)
File “/home/cl/jungmin-c/.pyenv/versions/anaconda3-5.1.0/envs/jp/lib/python3.7/site-packages/transformers/”, line 578, in _dict_from_json_file
text =
File “/home/cl/jungmin-c/.pyenv/versions/anaconda3-5.1.0/envs/jp/lib/python3.7/”, line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x80 in position 64: invalid start byte

After some searching, I gathered that I have to somehow convert my_model_name to a form that is acceptable to but I could not figure out how.

Can anyone suggest how you do this? I would greatly appreciate your help. Thank you!

Based on this post it seems you are trying to encode/decode an invalid character. What seems to be bit weird is that apparently a JSON file is expected (_dict_from_json_file is used), so my guess would be that the decoder tries to decode a wrong file format.