Attribute error while using run_language_modeling.py with Transformer-XL
python3 /home/username/.local/lib/python3.7/site-packages/transformers/transformers/examples/run_language_modeling.py \
    --output_dir=_outpath_
    --model_type=Transformer-XL\
    --model_name_or_path=transfo-xl-wt103 \
    --do_train \
    --train_data_file=_pathtodataset_
    --per_gpu_train_batch_size=1\
    --gradient_accumulation_steps=30\
    --train_epochs=50

Every time I run the above script I get the following error:

Traceback (most recent call last):
  File "/content/Essay/run_language_modeling.py", line 284, in <module>
    main()
  File "/content/Essay/run_language_modeling.py", line 208, in main
    model.resize_token_embeddings(len(tokenizer))
  File "/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py", line 336, in resize_token_embeddings
    model_embeds = base_model._resize_token_embeddings(new_num_tokens)
  File "/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py", line 351, in _resize_token_embeddings
    new_embeddings = self._get_resized_embeddings(old_embeddings, new_num_tokens)
  File "/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py", line 372, in _get_resized_embeddings
    old_num_tokens, old_embedding_dim = old_embeddings.weight.size()
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 576, in __getattr__
    type(self).__name__, name))
**AttributeError: 'AdaptiveEmbedding' object has no attribute 'weight'**
| | |
|----|---|
|OS |Fedora 29/Google Colab|
|Python|3.6|
|Pytorch|1.4.0/1.5.0|

The problem arises in each 4 cases with the XL model but not with other models.
Hey, sorry, it's been a while, but this was fixed in #4759 since.