CoolFace
Modelpublic

sureshbabugandla/ML_OPS_ASSIGNMENT2

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes16downloads
Model Card

DistilBERT Book Genre Classifier

A fine-tuned DistilBERT model for classifying book reviews into 8 genres.

Model Description

This model is based on distilbert-base-cased and was fine-tuned on the UCSD Goodreads book reviews dataset. It classifies a given book review text into one of 8 genres.

  • Model: distilbert-base-cased
  • Task: Multi-class text classification (8 genres)
  • Language: English
  • License: MIT

Supported Genres

LabelGenre
0Children
1Comics & Graphic
2Fantasy & Paranormal
3History & Biography
4Mystery, Thriller & Crime
5Poetry
6Romance
7Young Adult

Training Details

ParameterValue
Base modeldistilbert-base-cased
Epochs3
Batch size (train)16
Batch size (eval)32
Learning rate3e-5
Warmup steps100
Weight decay0.01
Max sequence length512
Train samples6,400
Test samples1,600
PlatformKaggle (GPU T4 x2)
TrackingWeights & Biases

Results

MetricScore
Accuracy0.5831
F1 Score (weighted)0.5810
Eval Loss2.2847

Per-Epoch Results

EpochTraining LossValidation LossAccuracyF1
12.57102.53370.55250.5454
22.12732.28590.59810.5983
31.61262.29230.60940.6089

How to Use

python
from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="sureshbabugandla/ML_OPS_ASSIGNMENT2"
)

result = classifier("This book was a thrilling mystery with unexpected twists.")
print(result)

Or load the model and tokenizer separately:

python
from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification

tokenizer = DistilBertTokenizerFast.from_pretrained("sureshbabugandla/ML_OPS_ASSIGNMENT2")
model = DistilBertForSequenceClassification.from_pretrained("sureshbabugandla/ML_OPS_ASSIGNMENT2")

Dataset

The model was trained on the UCSD Book Graph dataset, which contains book reviews from Goodreads across multiple genres. 2,000 reviews were sampled from each of the 8 genres, split into 800 train and 200 test samples per genre.

Developed By

  • Name: Suresh Babu Gandla
  • Roll Number: G25AIT2119

Links

  • GitHub: https://github.com/g25ait2119/MLOpsAssignment2
  • W&B Dashboard: https://wandb.ai/g25ait2119-sureshbabu-gandla/mlops-assignment2
  • Kaggle Notebook: https://www.kaggle.com/code/sureshbabugandla/mlops-a2-training