How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="YuvarajK-g25ait2054/distilbert-goodreads-genres")
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("YuvarajK-g25ait2054/distilbert-goodreads-genres")
model = AutoModelForSequenceClassification.from_pretrained("YuvarajK-g25ait2054/distilbert-goodreads-genres", device_map="auto")
Quick Links

DistilBERT Goodreads Genre Classification

Model Details

Developed by: Yuvaraj K
Model type: DistilBERT for Sequence Classification
Language: English
Finetuned from: distilbert-base-cased
Training platform: Kaggle GPU
Experiment tracking: Weights & Biases

Model Description

This model is a fine-tuned DistilBERT transformer model for classifying Goodreads book reviews into genre categories.

The model was trained as part of an MLOps assignment to demonstrate an end-to-end machine learning workflow including:

  • Kaggle GPU training
  • experiment tracking with Weights & Biases
  • model versioning with Hugging Face Hub
  • reproducible project management with GitHub

DistilBERT was selected because it is lightweight, faster than full BERT, and suitable for free GPU environments while maintaining strong classification performance.


Training Results

Metric Score
Accuracy 0.7950
F1 Score 0.7957
Eval Loss 1.1663

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = "YuvarajK-g25ait2054/distilbert-goodreads-genres"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

text = "This book was amazing and full of suspense."

inputs = tokenizer(text, return_tensors="pt", truncation=True)

outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1)

print(prediction)

Training Configuration

  • Epochs: 3
  • Batch Size: 16
  • Learning Rate: 3e-5
  • Weight Decay: 0.01
  • Warmup Steps: 100

Intended Use

This model is intended for educational demonstration of MLOps workflows and text classification tasks.


Limitations

  • Trained on a limited assignment dataset
  • Performance may vary on unseen review domains
  • Not intended for production deployment without further validation
Downloads last month
6
Safetensors
Model size
65.8M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support