Text Classification
Transformers
Safetensors
distilbert
prompt-classification
user-vs-system
text-embeddings-inference
Instructions to use rushi-shaharao/distilbert-prompt-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rushi-shaharao/distilbert-prompt-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="rushi-shaharao/distilbert-prompt-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("rushi-shaharao/distilbert-prompt-classifier") model = AutoModelForSequenceClassification.from_pretrained("rushi-shaharao/distilbert-prompt-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
π§ DistilBERT Prompt Classifier
This is a fine-tuned DistilBERT model for classifying prompt types as either "user prompt" or "system prompt". It is useful for distinguishing between different roles in conversation-based datasets like those used in chatbots, assistants, or instruction tuning.
β¨ Model Details
- Model Name: distilbert-prompt-classifier
- Developed by: Mayuresh Mane
- Base Model:
distilbert-base-uncased - Task: Text Classification (Binary)
- Labels:
0 = system prompt,1 = user prompt - Language: English
- License: Apache 2.0
- Framework: π€ Transformers
π Model Sources
- Model Hub: rushi-shaharao/distilbert-prompt-classifier
π‘ Uses
β Direct Use
You can use this model to classify any single prompt into either a system or user prompt.
π« Out-of-Scope Use
- Not intended for multi-language prompt classification.
- May not generalize well to noisy or adversarial text outside of prompt-type formatting.
π§ͺ How to Use
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import torch.nn.functional as F
model_name = "rushi-shaharao/distilbert-prompt-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
prompt = "You are a helpful assistant."
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
probs = F.softmax(outputs.logits, dim=1)
predicted_class = torch.argmax(probs, dim=1).item()
label_map = {0: "system prompt", 1: "user prompt"}
print(f"Predicted: {label_map[predicted_class]} ({probs[0][predicted_class]:.2f} confidence)")
- Downloads last month
- 6