Error: while executing run_qa.py from examples/pytorch/question-answering/  directory
I am using the Google Colab environment to perform QA task. To evaluate finetuned model I am using run_qa.py file but in the **STEP-2** below, while using run_qa.py, I am getting mentioned error.


**STEP1:**
In the first step, the bert_base_cased model trained on the MLM task is finetuned on QA task using SQuAD.

model = AutoModelForQuestionAnswering.from_pretrained(path_of_my_bert_base_cased_MLM_checkpoint)
args = TrainingArguments(
    f"test-squad",
    evaluation_strategy = "epoch",
    learning_rate=2e-5,
    per_device_train_batch_size=16,
    per_device_eval_batch_size=16,
    num_train_epochs=1,
    weight_decay=0.01,
)


_In the below code I am trying to freeze embedding learning for experimental purpose_

for param in model.parameters():
    param.requires_grad = True
for param in model.get_input_embeddings().parameters():
    param.requires_grad = False

data_collator = default_data_collator

tokenizer = BertTokenizer(<location-of-my-custom-vocab>,
                          do_lower_case=False,
                          model_max_length=128)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation"],
    data_collator=data_collator,
    tokenizer=tokenizer,
)
trainer.train()


**STEP 2:**

Now, while using above QA finetuned model with run_qa.py file with following parameters I am getting _panicked at 'assertion failed:_' error :

python run_qa.py  \
    --model_name_or_path  <path-to-my-above-model>\
    --dataset_name xquad \
    --dataset_config_name xquad.hi \
    --do_eval \
    --per_device_train_batch_size 12 \
    --learning_rate 3e-5 \
    --num_train_epochs 2 \
    --max_seq_length 384 \
    --doc_stride 128 \
    --output_dir /content

Error Message:

06/22/2021 04:49:39 - WARNING - __main__ -   The max_seq_length passed (384) is larger than the maximum length for themodel (128). Using max_seq_length=128.
Running tokenizer on validation dataset:   0% 0/2 [00:00<?, ?ba/s]thread '<unnamed>' panicked at 'assertion failed: stride < max_len', /__w/tokenizers/tokenizers/tokenizers/src/tokenizer/encoding.rs:322:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace



## Environment info

- `transformers` version: 4.8.0.dev0
- Platform:Linux-5.4.104+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.10
- PyTorch version (GPU?):1.9.0+cu102 (True)
- Tensorflow version (GPU?):2.5.0 (True)
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: parallel set-up

### Who can help
@LysandreJik,@sgugger, @patil-suraj



You are using a model with `max_length = 128` but then pass along `max_seq_length 384`, which is overridden to become 128 since that is the maximum the tokenizer thinks the model can handle because of:
```
tokenizer = BertTokenizer(do_lower_case=False, model_max_length=128)
```
and then trying to use a stride of 128. Either pick a greater max length or lower the stride to be < 128.<|||||>@sgugger Thanks a lot. I have reduced stride and it is working now. 