# How to Finetune Deberta Model on SQUAD dataset?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-finetune-deberta-model-on-squad-dataset%2F3391%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 26, 2021, 11:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-finetune-deberta-model-on-squad-dataset%2F3391 "2021-01-26T11:43:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhadresh-savani](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bhadresh-savani/32/30594_2.png) [@bhadresh-savani](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbhadresh-savani)%5C
**Post date:** [January 26, 2021, 11:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-finetune-deberta-model-on-squad-dataset%2F3391%2F1 "2021-01-26T11:43:50Z")

</div>

Hi All,

I am trying to finetune DeBerta Model on SQUAD. If I try existing notebooks like [this](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/question_answering.ipynb) It uses Trainer and Fast Tokenizer.

DeBerta doesn’t have support for Fast Tokenizer Yet. How can I finetune it on SQUAD?

I am also willing to implement Fast Tokenizer for the Deberta model, Can anyone help me with resources so I can get started with that?

Here is my notebook for training [Deberta](https://github.com/bhadreshpsavani/UnderstandingNLP/blob/master/Finetuning_DeBERTa_SQUAD.ipynb) (I am facing issues)

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flewtun)%5C
**Post date:** [January 26, 2021, 1:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-finetune-deberta-model-on-squad-dataset%2F3391%2F2 "2021-01-26T13:01:49Z")

</div>

Hi @bhadresh-savani, as far as I can tell the problem seems to lie with your `find_sublist_indices` function, not on the availability of a fast tokenizer.

One simple thing to try: can you pass a slice of examples to your `convert_to_features` function, e.g.

```auto
convert_to_features(train_dataset[:3])

```

I’m not sure whether this will solve the problem, but perhaps your `find_sublist_indices` is expected a list of lists which is what you’ll get from the slice.

I also noticed that your `convert_to_features` function is quite different to the `prepare_train_features` in the tutorial - what happens if you try the latter with your tokenizer?

If that doesn’t work, then you might be able to use the old `run_qa.py` script that doesn’t rely on fast tokenizers: [transformers/examples/legacy/question-answering at master · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/tree/master/examples/legacy/question-answering)

Lewis

---

<div class="post-metadata">

**Author:** ![bhadresh-savani](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bhadresh-savani/32/30594_2.png) [@bhadresh-savani](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbhadresh-savani)%5C
**Post date:** [January 27, 2021, 10:20am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-finetune-deberta-model-on-squad-dataset%2F3391%2F3 "2021-01-27T10:20:15Z")

</div>

Hi @lewtun

Thanks for your answer

I tried to run old version `v3.5.1` by keeping latest version of `modeling_deberta.py` file with few changes (i needed `QuestionAnsweringModelOutput` class for SQUAD kind of training)

I was getting below error

```auto
    Traceback (most recent call last):
  File "run_squad.py", line 820, in <module>
    main()
  File "run_squad.py", line 734, in main
    model = AutoModelForQuestionAnswering.from_pretrained(
  File "/media/data2/anaconda/envs/transformers-hugginface/lib/python3.8/site-packages/transformers/modeling_auto.py", line 1330, in from_pretrained
    raise ValueError(
ValueError: Unrecognized configuration class <class 'transformers.configuration_deberta.DebertaConfig'> for this kind of AutoModel: AutoModelForQuestionAnswering.
Model type should be one of DistilBertConfig, AlbertConfig, CamembertConfig, BartConfig, LongformerConfig, XLMRobertaConfig, RobertaConfig, SqueezeBertConfig, BertConfig, XLNetConfig, FlaubertConfig, MobileBertConfig, XLMConfig, ElectraConfig, ReformerConfig, FunnelConfig, LxmertConfig. 

```

`find_sublist_indices` i created by taking ref of this [notebook](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) which uses a fast tokenizer, I am trying to do the same without fast tokenizer

Fast tokenizer has method called `char_to_token` i am trying to implement the same on Python based tokenizer.

Hi @valhalla,

Can you tell me how can i use the same [notebook](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) without fast tokenizer since it was created by you?
