SuganyaP's picture
Update README.md
c2668f8 verified
metadata
language: en
license: mit
datasets:
  - imdb
metrics:
  - accuracy
  - f1
pipeline_tag: text-classification
base_model: distilbert/distilbert-base-uncased
library_name: transformers
tags:
  - fine-tune-model
  - sentiment-analysis
  - distilbert
  - text-classification
  - imdb

DistilBERT IMDB Sentiment Classifier

Overview

This repository contains a fine-tuned DistilBERT model for binary sentiment classification on the IMDB movie reviews dataset. The model predicts whether a given review expresses positive or negative sentiment. It is intended as a lightweight, reproducible NLP model suitable for demonstrations, small-scale applications, and experimentation.

Base Model

  • Model: distilbert-base-uncased
  • Framework: Hugging Face Transformers
  • Task: Text Classification (Binary Sentiment)

Training Details

  • Dataset: IMDB movie review dataset (train/test split)
  • Objective: Binary sentiment classification
  • Optimization:
    • Adam optimizer
    • Learning rate scheduling
    • Early stopping
  • Regularization:
    • Dropout applied as per DistilBERT architecture
    • Gradient clipping

Evaluation Metrics

The model was evaluated using standard binary classification metrics:

  • Accuracy
  • Precision
  • Recall
  • F1-score

Inference Example

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_name = "SuganyaP/quick-distilbert-imdb"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

inputs = tokenizer("This movie was excellent!", return_tensors="pt")
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits).item()

print("Positive" if prediction == 1 else "Negative")