Zum Inhalt springen
ModelÜberprüftExtern
Herunterladen

Distilbert Goodreads Genres

A transformer-based model fine-tuned to classify Goodreads reviews into eight distinct genres.

ArtEmbeddingVersionRevision a8a4306Verleger@Rashmii30CBewertung

Modellquelle

Art
Embedding
Dateigröße
251 MB
Version
vRevision a8a4306
Aktualisiert
3. Okt. 2026
Verleger
@Rashmii30
Downloads
8
Quelle
Hugging Face

Quellenbeschreibung

Model

DistilBERT Book Genre Classifier

A transformer-based model fine-tuned to classify Goodreads reviews into eight distinct genres.

Key Features Model: DistilBERT (Transformer-based) Dataset: Goodreads book reviews Output: 8 genre categories Task: Multi-class text classification

Model Description

This model is a specialized text classification tool designed to bridge the gap between subjective reader feedback and structured metadata. By fine-tuning the DistilBERT architecture a lighter, faster version of the original BERT model—this classifier can interpret the nuance, tone, and vocabulary used in Goodreads reviews to predict a book's genre. Unlike traditional keyword matching, this model uses deep learning to understand the context of a review. It can distinguish between the "thrilling" elements of a mystery and the "breathless" excitement found in a romance. This makes it an ideal solution for organizing large digital libraries, enhancing recommendation engines, or helping authors understand how their work is being perceived by specific audiences.

Supported Genres

The model categorizes reviews into the following eight

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

Training Configuration

ParameterValue
Base Modeldistilbert-base-cased
Epochs3
Train Batch Size16
Eval Batch Size32
Learning Rate3e-5
Warmup Steps100
Weight Decay0.01
Max Sequence Length512
Training Samples6,400
Test Samples1,600
PlatformKaggle (GPU T4 x2)
Experiment TrackingWeights & Biases

Training Results

EpochTraining LossValidation LossAccuracyF1
12.5430572.3892330.5831250.582607
21.9550182.2497880.6037500.605045
31.4337142.2744780.6087500.611895

Final Evaluation Metrics

MetricScore
Accuracy0.608750
F1 Score0.611895
Eval Loss2.274478

Installation

Install the required libraries:

pip install transformers torch

Quick Inference

Use the Hugging Face pipeline API:

from huggingface_hub import login

# Login to HuggingFace using token from Kaggle Secrets
login(token=HF_TOKEN)
print("Logged in to HuggingFace!")


HF_USERNAME = "Rashmii30"
REPO_NAME = "distilbert-goodreads-genres"
HF_REPO = f"{HF_USERNAME}/{REPO_NAME}"

# Push model weights to HuggingFace Hub
print("Pushing model to HuggingFace Hub...")
model.push_to_hub(HF_REPO)
print("Model pushed successfully!")

# Push tokenizer to same repository
print("Pushing tokenizer to HuggingFace Hub...")
tokenizer.push_to_hub(HF_REPO)
print("Tokenizer pushed successfully!")

# Log the HuggingFace URL to W&B run summary
wandb.run.summary["huggingface_model"] = f"https://huggingface.co/{HF_REPO}"
print(f"HuggingFace model URL logged to W&B!")
print(f"Your model is live at: https://huggingface.co/{HF_REPO}")

Dataset

The model was trained using the UCSD Book Graph / Goodreads Reviews Dataset, which contains large-scale Goodreads book reviews across multiple genres.

8 genres were selected

2,000 reviews sampled per genre

Stratified train-test split:

 800 training samples per genre
 200 test samples per genre
 

Project Highlights

Fine-tuned transformer-based NLP classifier GPU training on Kaggle Experiment tracking using Weights & Biases Hugging Face model deployment Reproducible MLOps workflow

Technologies Used

Python PyTorch Hugging Face Transformers Dataset Weights & Biases Kaggle Notebooks

Author

Name: Rashmi Kumari Roll Number: G25AIT2083

Model Repository

Hugging Face Model Repository

Quellen

1 Quelle
Hugging FacePrimärVersion a8a4306d3633ba8434711616ebaa991f26d31473
huggingface.co/Rashmii30/distilbert-goodreads-genres/tree/a8a4306d3633ba8434711616ebaa991f26d31473

Verifiziert 3. Okt.

Modellartefakte

1 Artefakt

model.safetensors

safetensors · 251 MB · SHA-256 371b69fc01eb…1af8 · Hugging Face

Herunterladen

Quellenauszüge

3 Auszüge

--- library_name: transformers tags: [] --- # Model DistilBERT Book Genre Classifier A transformer-based model fine-tuned to classify Goodreads reviews into eight distinct genres. Key Features Model: DistilBERT (Transformer-based) Dataset: Goodreads book reviews Output: 8 genre categories Task: Multi-class text classification ### Model Description This model is a specialized text classification tool designed to bridge the gap between subjective reader feedback and structured metadata. By fine-tuning the DistilBERT architecture a lighter, faster version of the original BERT model—this classifier can interpret the nuance, tone, and vocabulary used in Goodreads reviews to predict a book's genre. Unlike traditional keyword matching, this model uses deep learning to understand the context of a review. It can distinguish between the "thrilling" elements of a mystery and the "breathless" excitement found in a romance. This makes it an ideal solution for organizing large digital libraries, enhancing recommendation engines, or helping authors understand how their work is being perceived by specific audiences. ## Supported Genres The model categorizes reviews into the following eight **Label** **Genre** 0 Children 1 Comics & Graphic 2 Fantasy & Paranormal 3 History & Biography 4 Mystery, Thriller & Crime 5 Poetry 6 Romance 7 Young Adult ## Training Configuration | Parameter | Value | | :--- | :--- | | **Base Model** | distilbert-base-cased | | **Epochs** | 3 | | **Train Batch Size** | 16 | | **Eval Batch Size** | 32 | | **Learning Rate** | 3e-5 | | **Warmup Steps** | 100 | | **Weight Decay** | 0.01 | | **Max Sequence Length** | 512 | | **Training Samples** | 6,400 | | **Test Samples** | 1,600 | | **Platform** | Kaggle (GPU T4 x2) | | **Experiment Tracking** | Weights & Biases | ## Training Results | Epoch | Training Loss | Validation Loss | Accuracy | F1 | |-------|--------------|-----------------|----------|----| | 1 | 2.543057 | 2.389233 | 0.583125 | 0.582607 | | 2 | 1.955018 | 2.249788 | 0.603750 | 0.605045 | | 3 | 1.433714 | 2.274478 | 0.608750 | 0.611895 | ## Final Evaluation Metrics | Metric | Score | |--------|-------| | Accuracy | 0.608750 | | F1 Score | 0.611895 | | Eval Loss | 2.274478 | ## Installation Install the required libraries: ```bash pip install transformers torch ``` ## Quick Inference Use the Hugging Face pipeline API: ```b...

Source context: 8 downloads · 1 likes · Pipeline text-classification · Library transformers · Repo Rashmii30/distilbert-goodreads-genres

Source context: 1 downloads · 1 likes · Pipeline text-classification · Library transformers · Repo Rashmii30/distilbert-goodreads-genres