Text Classification
Transformers
Safetensors
English
distilbert
sentiment
football
fine-tuning
text-embeddings-inference
Run this model with HF Jobs
Run kevinkyi/Homework2_Finetuning on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/kevinkyi/Homework2_Finetuning. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/kevinkyi/Homework2_Finetuning on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use kevinkyi/Homework2_Finetuning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kevinkyi/Homework2_Finetuning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="kevinkyi/Homework2_Finetuning")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("kevinkyi/Homework2_Finetuning") model = AutoModelForSequenceClassification.from_pretrained("kevinkyi/Homework2_Finetuning", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add model card
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071---library_name: transformerslicense: apache-2.0base_model: distilbert-base-uncasedtags:- generated_from_trainermetrics:- accuracy- precision- recall- f1model-index:- name: Homework2_Finetuningresults: []---<!-- This model card has been generated automatically according to the information the Trainer had access to. Youshould probably proofread and complete it, then remove this comment. --># Homework2_FinetuningThis model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on the None dataset.It achieves the following results on the evaluation set:- Loss: 0.0030- Accuracy: 1.0- Precision: 1.0- Recall: 1.0- F1: 1.0## Model descriptionMore information needed## Intended uses & limitationsMore information needed## Training and evaluation dataMore information needed## Training procedure### Training hyperparametersThe following hyperparameters were used during training:- learning_rate: 3e-05- train_batch_size: 16- eval_batch_size: 16- seed: 42- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08- lr_scheduler_type: linear- lr_scheduler_warmup_ratio: 0.1- num_epochs: 5### Training results| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 ||:-------------:|:-----:|:----:|:---------------:|:--------:|:---------:|:------:|:------:|| 0.1158 | 1.0 | 55 | 0.0315 | 0.9909 | 0.9821 | 1.0 | 0.9910 || 0.0043 | 2.0 | 110 | 0.0083 | 1.0 | 1.0 | 1.0 | 1.0 || 0.002 | 3.0 | 165 | 0.0017 | 1.0 | 1.0 | 1.0 | 1.0 || 0.0014 | 4.0 | 220 | 0.0012 | 1.0 | 1.0 | 1.0 | 1.0 |### Framework versions- Transformers 4.45.2- Pytorch 2.8.0+cu126- Datasets 2.21.0- Tokenizers 0.20.31234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798---library_name: transformerspipeline_tag: text-classificationlicense: mittags:- distilbert- sentiment- football- fine-tuningmodel_name: DistilBERT Football Sentiment (Positive vs Negative)language:- en---# DistilBERT Football Sentiment — Positive vs Negative## PurposeFine-tune a compact transformer (DistilBERT) to classify short football-related comments as **positive (1)** or **negative (0)**. This supports a course assignment on text modeling and evaluation.## Dataset- **Source:** `james-kramer/football_news` on Hugging Face.- **Schema:** `text` (string), `label` (0/1).- **Task:** Binary sentiment classification (`0=negative`, `1=positive`).- **Splits:** Stratified **80/10/10** (train/val/test) created in this notebook.- **Cleaning:** Strip text, drop empty/NA rows.## Preprocessing- **Tokenizer:** `distilbert-base-uncased` (uncased), `max_length=256`, truncation.- **Label mapping:** `{0: "negative", 1: "positive"}`.## Training Setup- **Base model:** `distilbert-base-uncased`- **Epochs:** 5- **Batch size:** 16- **Learning rate:** 3e-05- **Weight decay:** 0.01- **Warmup ratio:** 0.1- **Early stopping:** patience = 2 (monitor F1 on validation)- **Seed:** 42- **Hardware:** Google Colab (GPU)## Metrics (Held-out Test)```json{"eval_loss": 0.0029852271545678377,"eval_accuracy": 1.0,"eval_precision": 1.0,"eval_recall": 1.0,"eval_f1": 1.0,"eval_runtime": 0.3123,"eval_samples_per_second": 352.273,"eval_steps_per_second": 22.417,"epoch": 4.0}```## Confusion Matrix & ErrorsThe Colab notebook includes a confusion matrix for validation and test, plus a short error analysis with example misclassifications and hypotheses (e.g., injury news phrased neutrally but labeled negative).| | Pred 0 | Pred 1 ||-----------|-------:|-------:|| **True 0**| 55 | 0 || **True 1**| 0 | 55 |## Brief Error Analysis (Concrete Examples & Hypotheses)Below are several misclassified examples with likely causes and fixes:1. **Text:** "<paste misclassified sentence #1>"**True:** 0 (negative) • **Pred:** 1 (positive)**Why it failed (hypothesis):** "<e.g., neutral phrasing with positive words outweighed injury cue>"**Potential fix:** "<e.g., add more injury/neutral-negative examples; reweight class; augment with negation patterns>"2. **Text:** "<paste misclassified sentence #2>"**True:** 1 (positive) • **Pred:** 0 (negative)**Why it failed (hypothesis):** "<e.g., sarcasm or mixed sentiment>"**Potential fix:** "<e.g., include sarcastic examples; leverage larger model or polarity lexicon features>"3. **Text:** "<paste misclassified sentence #3>"**True:** <0/1> • **Pred:** <1/0>**Why it failed (hypothesis):** "<e.g., domain shift, team/league slang>"**Potential fix:** "<e.g., add domain-specific samples; modest LR warmup or longer training>"## Limitations & Ethics- Dataset size and labeling style can lead to unstable metrics; neutral/ambiguous tone is hard.- Sports injury and team-management news may bias wording and labels.- For coursework only; not for production or sensitive decisions.## Reproducibility- Python: 3.12- Transformers: >=4.41- Datasets: >=2.19- Seed: 42## License- Code & weights: MIT (adjust per course guidelines)- Dataset: see the original dataset's license/terms## AI Assistance Disclosure- GenAI tools assisted with notebook structure and documentation; modeling choices and evaluation were implemented and verified by the author.
README.md+93-66