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

!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))

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

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

Hi,

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