Model I am using (Bert, XLNet ...): XLNet
Language I am using the model on (English, Chinese ...): English
The problem arises when using:
The tasks I am working on is:
Steps to reproduce the behavior:
!git clone https://github.com/huggingface/transformers.git
2.
!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
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'
The model should start training from the first epoch.
transformers version: 2.9.0I also have the same problem @alexandrenriq
I think there's a mistake in the code which sets the AutoModelForQuestionAnswering as XLNetForQuestionAnsweringSimple. You can run the code by substituting AutoModelForQuestionAnswering into XLNetForQuestionAnswering (or by removing cls_index and p_mask in the batches to make XLNetForQuestionAnsweringSimple work).
Nevertheless, after the training is done, I can't reproduce the scores right (Results: {'exact': 0.03784295175023652, 'f1': 0.6317807409886281,...).
I also found the same issue, and I believe this issue appears for a very very long time.
see also #3535
see also #3535
@brettkoonce I saw it, it didn't work.
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.