--- license: apache-2.0 base_model: distilbert-base-uncased tags: - generated_from_trainer - emotion_classfication metrics: - accuracy - f1 model-index: - name: distilbert-base-uncased-finetuned-emotion-classification-10_epochs results: [] datasets: - dair-ai/emotion language: - en --- # distilbert-base-uncased-finetuned-emotion-classification-10_epochs This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on an unknown dataset. It achieves the following results on the evaluation set: - Loss: 0.1464 - Accuracy: 0.9375 - F1 score: 0.9376 ## Model description This model is fine-tuned on the 'emotion' dataset to classify text into six emotion categories: sadness, joy, love, anger, fear, and surprise. ## Use the Model ```python from transformers import pipeline import pandas as pd emt_clf = pipeline("text-classification", model="Swoodplays/emotion-classification") text = "I saw a movie today and it was really good." preds = emt_clf(text, return_all_scores=True) labels = ['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'] print(preds) preds_df = pd.DataFrame(preds[0]) plt.bar(labels, 100 * preds_df["score"]) plt.title(f'"{text}"') plt.xlabel("Classfied emotions") plt.ylabel("Class probability (%)") plt.show() ``` ## Training and evaluation data dair-ai/emotion ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 128 - eval_batch_size: 128 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 10 ### Training results | Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 score | |:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:| | No log | 1.0 | 125 | 0.4449 | 0.873 | 0.8654 | | No log | 2.0 | 250 | 0.2166 | 0.9265 | 0.9270 | | No log | 3.0 | 375 | 0.1726 | 0.933 | 0.9339 | | No log | 4.0 | 500 | 0.1552 | 0.9385 | 0.9386 | | No log | 5.0 | 625 | 0.1439 | 0.938 | 0.9383 | | No log | 6.0 | 750 | 0.1435 | 0.937 | 0.9370 | | No log | 7.0 | 875 | 0.1481 | 0.9355 | 0.9356 | | No log | 8.0 | 1000 | 0.1402 | 0.935 | 0.9352 | | No log | 9.0 | 1125 | 0.1491 | 0.9355 | 0.9355 | | No log | 10.0 | 1250 | 0.1464 | 0.9375 | 0.9376 | ### Framework versions - Transformers 4.44.0 - Pytorch 2.4.0 - Datasets 2.21.0 - Tokenizers 0.19.1