Third Class Model

#4
by SouravAhmed - opened

image.png

# https://huggingface.co/vineetsharma/customer-support-intent-albert
!pip install transformers torch

from transformers import AutoTokenizer, AutoModelForSequenceClassification

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("vineetsharma/customer-support-intent-albert")
model = AutoModelForSequenceClassification.from_pretrained("vineetsharma/customer-support-intent-albert")

# Set model to evaluation mode
model.eval()
import torch
# Sample input
customer_query = "show me the latest iphone"

# Tokenize the input
inputs = tokenizer(customer_query, return_tensors="pt")

# Perform inference
with torch.no_grad():
    outputs = model(**inputs)

labels = model.config.id2label
print("outputs: ", outputs)

# Get predicted class
predicted_class = outputs.logits.argmax(-1).item()
predicted_label = labels[predicted_class]


print(f"Predicted intent: {predicted_label}")
print(f"Predicted class: {predicted_class}")

** i dont think am doing anything wrong. **

image.png

Fined Tuned ???

Sign up or log in to comment