# Getting KeyError: 'logits' when trying to run deberta model

**URL:** <https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012>\
**Category:** Beginners\
**Created:** [October 23, 2021, 6:37am UTC](https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012 "2021-10-23T06:37:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NDugar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ndugar/32/40501_2.png) [@NDugar](https://discuss.huggingface.co/u/NDugar)\
**Post date:** [October 23, 2021, 6:37am UTC](https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012/1 "2021-10-23T06:37:49Z")

</div>

```auto
!pip install sentencepiece --upgrade
!pip install transformers --upgrade
from transformers import pipeline,AutoModel,AutoTokenizer

model =AutoModel.from_pretrained("microsoft/deberta-v2-xxlarge-mnli")
tokenizer = AutoTokenizer.from_pretrained("microsoft/deberta-v2-xxlarge")
classifier = pipeline("zero-shot-classification",model=model,tokenizer=tokenizer)

sequence = "Bob: Hey, how is work going? , Amy: Good, I wanted to talk to you about your work performance."
candidate_labels = ["Bob is talking about the same topic as Amy.", "Amy explained to Bob why he is not doing well.", "Bob asked how Amy is.", "Bob brought up the topic of work performance."]

print(classifier(sequence, candidate_labels))

```

---

<div class="post-metadata">

**Author:** ![NDugar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ndugar/32/40501_2.png) [@NDugar](https://discuss.huggingface.co/u/NDugar)\
**Post date:** [October 23, 2021, 6:39am UTC](https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012/2 "2021-10-23T06:39:14Z")

</div>

also, how do I fine-tune such a model for my purpose?

---

<div class="post-metadata">

**Author:** ![KavyaShankar](https://avatars.discourse-cdn.com/v4/letter/k/90ced4/32.png) [@KavyaShankar](https://discuss.huggingface.co/u/KavyaShankar)\
**Post date:** [July 27, 2022, 6:26pm UTC](https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012/3 "2022-07-27T18:26:13Z")

</div>

Were you able to solve the issue? I’m having the same issue.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [July 28, 2022, 7:55am UTC](https://discuss.huggingface.co/t/getting-keyerror-logits-when-trying-to-run-deberta-model/11012/4 "2022-07-28T07:55:00Z")

</div>

Hi,

You need to replace `AutoModel` by `AutoModelForSequenceClassification` in the code snippet above (since `AutoModel` doesn’t include a classification head on top).
