question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with XLNet using xlnet-base-cased

See original GitHub issue

🐛 Bug

Information

Model I am using (Bert, XLNet …): XLNet

Language I am using the model on (English, Chinese …): English

The problem arises when using:

  • the official example scripts: (give details below)
  • my own modified scripts: (give details below)

The tasks I am working on is:

  • an official GLUE/SQUaD task: SQUaD v1.1
  • my own task or dataset: (give details below)

To reproduce

Steps to reproduce the behavior:

  1. Clone the repository
!git clone https://github.com/huggingface/transformers.git
!python ./transformers/examples/question-answering/run_squad.py \
    --model_type xlnet \
    --model_name_or_path xlnet-base-cased \
    --do_train \
    --do_eval \
    --train_file $SQuAD_Dir/train-v1.1.json \
    --predict_file $SQuAD_Dir/dev-v1.1.json \
    --learning_rate 3e-5 \
    --num_train_epochs 2 \
    --max_seq_length 384 \
    --doc_stride 128 \
    --output_dir ./model_output \
    --per_gpu_eval_batch_size=4  \
    --per_gpu_train_batch_size=4   \
    --save_steps 5000
  1. Error
Epoch:   0% 0/2 [00:00<?, ?it/s]
Iteration:   0% 0/15852 [00:00<?, ?it/s]Traceback (most recent call last):
  File "./transformers/examples/question-answering/run_squad.py", line 830, in <module>
    main()
  File "./transformers/examples/question-answering/run_squad.py", line 769, in main
    global_step, tr_loss = train(args, train_dataset, model, tokenizer)
  File "./transformers/examples/question-answering/run_squad.py", line 204, in train
    outputs = model(**inputs)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument 'cls_index'

Expected behavior

The model should start training from the first epoch.

Environment info

  • transformers version: 2.9.0
  • Platform: Google Colab Pro
  • Python version: 3.6.9
  • PyTorch version (GPU?): 1.5.0+cu101 (Yes)
  • Tensorflow version (GPU?): 2.2.0 (Yes)
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
yyHakercommented, May 12, 2020

I also have the same problem @alexandrenriq

0reactions
stale[bot]commented, Sep 30, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xlnet-base-cased - Hugging Face
Model description. XLNet is a new unsupervised language representation learning method based on a novel generalized permutation language ...
Read more >
How to use XLNET from the Hugging Face transformer library
In this article, I will demonstrate how to use XLNET using the Hugging Face Transformer library for three important tasks.
Read more >
XLNet Embeddings (Base Cased) - Spark NLP
XLNet is a new unsupervised language representation learning method based on a novel generalized permutation language modeling objective.
Read more >
Using XLNet for Sentiment Classification | by Shanay Ghag
Learn how to fine-tune pretrained XLNet model from Huggingface transformers ... XLNetTokenizer.from_pretrained('xlnet-base-cased')input_txt ...
Read more >
BERT, XLNet or RoBERTa: The Best Transfer Learning Model ...
In this work we fine-tuned BERT, XLNet and RoBERTa models by integrating ... bert-base-cased and therefore we used bert-base-uncased in.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found