Instructions to use Marty-17/emotion-classification-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Marty-17/emotion-classification-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Marty-17/emotion-classification-model")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Marty-17/emotion-classification-model") model = AutoModelForSequenceClassification.from_pretrained("Marty-17/emotion-classification-model", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Model description
This model is a fine-tuned version of distilbert-base-uncased on the dataset dair-ai/emotion dataset. The model is fine tuned to label text into six different emotional categories. These categories being:
- (0) joy, (1) love, (2) anger, (3) fear, (4), surprise (5).
The model achieved the following results below:
- Validation Accuracy: 93.7%
- Test Accuracy: 92%
Intended use
- Analyse text data
- Classify text data as one of the six emotions
- Tested on its ability to classify text into six previously mentioned emotional categories
Training and evaluation data
- The model was trained and evaluated with dair-ai/emotion dataset
- Training set: 16,000 examples
- Validation set: 2,000 examples
- Test set: 2,000 examples
Limitations and Biases
- Model may struggle to understand emotions that require more context.
- Does not capture more nuanced emotions given that are only six emotional categories
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 16
- eval_batch_size: 8
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 2
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 0.2517 | 1.0 | 1000 | 0.1897 | 0.922 |
| 0.1476 | 2.0 | 2000 | 0.1656 | 0.9335 |
Code Usage Example
classifier = pipeline("text-classification", model = "Marty-17/emotion-classification-model",tokenizer="Marty-17/emotion-classification-model") # Create Pipeline
test_text = ["I am so Happy Today !",
"I am not Happy Today !",
"I do not fear being happy"
] # Test cases
result = classifier(test_text)
#Loop and display results for the test case.
for i,text in enumerate(test_text):
label= result[i]['label']
score = result[i]['score']
print(f"Text Example:{text}")
print(f"Predicted Label: {label}")
- Downloads last month
- 35
Model tree for Marty-17/emotion-classification-model
Base model
distilbert/distilbert-base-uncased