from transformers import AutoModelForSequenceClassification, AutoTokenizerimport torch
# Load model and tokenizermodel = AutoModelForSequenceClassification.from_pretrained( "vllm-sr/mmbert32k-feedback-detector-merged")tokenizer = AutoTokenizer.from_pretrained( "vllm-sr/mmbert32k-feedback-detector-merged")model.eval()
# Label mappinglabels = ["SAT", "NEED_CLARIFICATION", "WRONG_ANSWER", "WANT_DIFFERENT"]
# Example inferencetexts = [ "Thank you, that's exactly what I needed!", "I don't understand, can you explain more?", "That's incorrect, the answer should be different.", "Can you give me another approach?",]
for text in texts: inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512) with torch.no_grad(): outputs = model(**inputs) probs = torch.softmax(outputs.logits, dim=-1) pred = outputs.logits.argmax(-1).item() conf = probs[0][pred].item() print(f"{labels[pred]:20} ({conf:.1%}) | {text}")