YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Emotion Classification with DistilBERT

Fine-tuning DistilBERT modelu do klasyfikacji 6 emocji: sadness, joy, love, anger, fear, surprise.

Wyniki

  • Accuracy: 93.7% na zbiorze testowym (2000 przykladow)
  • Precyzja: 92.6% (weighted average)
  • Czulosc (Recall): 92.7% (weighted average)
  • Wynik F1: 92.63% (weighted average)
  • Validation accuracy: 93.8% (epoch 2)
  • Model: DistilBERT (6 layers, 66M parameters)
  • Dataset: Hugging Face 'emotion' (16k train, 2k val, 2k test)

link do pobrania modelu

https://huggingface.co/Neks0ne/cl_2 git clone https://huggingface.co/Neks0ne/cl_2

Instalacja

# Z GPU (zalecane)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt

Uzycie

Uruchomienie pelnego pipeline'u:

python src/run.py

Opis funkcji (właczanie/wylaczanie w run.py)

download_data() - Pobiera zbior 'emotion' z Hugging Face Hub (16k train + 2k val + 2k test)

#download_data()  # Odkomentuj aby pobrac dane

preprocess_data() - Tokenizuje teksty (max 128 tokenow, padding, truncation). Zapisuje do emotion_tokenized/

#preprocess_data()  # Odkomentuj aby przetworzyc dane

train_model() - Fine-tuning DistilBERT na 6 emocji. Domyslnie: epochs=3, batch=16, lr=2e-5. Zapisuje do models/emotion_classifier/

#train_model()  # Domyslne parametry (3 epoki, batch=16, lr=2e-5)
#train_model(num_epochs=5, batch_size=32, learning_rate=1e-5)  # Wlasne parametry

evaluate_model() - Ewaluacja na zbiorze testowym (accuracy, precision, recall, F1, confusion matrix)

#evaluate_model()  # Odkomentuj aby ewaluowac model

predict_emotion(file_path) - Inferencja: przewiduje emocje dla tekstow z pliku. Domyslnie sample_data.txt

predict_emotion()  # Domyslnie sample_data.txt
# predict_emotion('./sciezka/do/wlasnego/pliku.txt')  # Wlasny plik

sample_data.txt

Format: jeden tekst na linie, puste linie ignorowane. Przyklad:

I love this so much, it makes me incredibly happy!
This is the worst day of my life, I'm so sad.
I'm furious about this situation!
I'm terrified of what might happen.
What a wonderful surprise, I didn't expect this at all!

Konfiguracja trenowania

Domyslne parametry:

  • Max token length: 128
  • Batch size: 16
  • Learning rate: 2e-5
  • Epochs: 3
  • Hardware: NVIDIA GPU (CUDA 12.1)

Dostosowanie parametrow w run.py:

train_model(num_epochs=5, batch_size=32, learning_rate=1e-5)

Parametry:

  • num_epochs: liczba epok (wiecej = lepsze, dlusze)
  • batch_size: rozmiar batcha (wiekszy = szybciej, wiecej RAM)
  • learning_rate: wspolczynnik uczenia (mniejszy = stabilniejszy, wolniejszy)

Troubleshooting

CUDA out of memory: zmniejsz batch_size w train.py Brak GPU: trenowanie na CPU bedzie dlugie, zalecany GPU

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support