Applied RAG & Natural Language Processing
Collection
End-to-end Retrieval-Augmented Generation architectures, benchmark evaluation datasets, and sequence classification pipelines. β’ 4 items β’ Updated
How to use Jayan12321/distilbert-emotion-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Jayan12321/distilbert-emotion-classifier") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("Jayan12321/distilbert-emotion-classifier")
model = AutoModelForMaskedLM.from_pretrained("Jayan12321/distilbert-emotion-classifier", device_map="auto")A fine-tuned DistilBERT (Distilled Bidirectional Encoder Representations from Transformers) sequence classification model trained to detect nuanced affective and emotional states from unstructured natural language.
The model classifies text across 6 primary emotional dimensions:
0: Sadness (grief, sorrow, exhaustion)1: Joy (happiness, triumph, gratitude)2: Love (affection, admiration, intimacy)3: Anger (irritation, frustration, rage)4: Fear (anxiety, dread, panic)5: Surprise (shock, amazement, disbelief)from transformers import pipeline
# Load fine-tuned pipeline directly from Hugging Face
classifier = pipeline(
"text-classification",
model="Jayan12321/distilbert-emotion-classifier"
)
# Run inference
sample_text = "I received the scholarship offer this morning and I cannot stop smiling!"
prediction = classifier(sample_text)
print(prediction)
# Output: [{'label': 'joy', 'score': 0.987}]