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:
- 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
- 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:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also have the same problem @alexandrenriq
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.