Instructions to use g25ait2149/distilbert-goodreads-genres with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use g25ait2149/distilbert-goodreads-genres with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="g25ait2149/distilbert-goodreads-genres")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("g25ait2149/distilbert-goodreads-genres") model = AutoModelForSequenceClassification.from_pretrained("g25ait2149/distilbert-goodreads-genres", device_map="auto") - Notebooks
- Google Colab
- Kaggle
language:
- en
license: mit
tags:
- text-classification
- fine-tuned
- distilbert
- pytorch
- transformers
datasets:
- goodreads-genres
metrics:
- accuracy
- f1
pipeline_tag: text-classification
model-index:
- name: DistilBERT Goodreads Genre Predictor
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Goodreads Book Summaries
type: goodreads-genres
metrics:
- type: accuracy
value: 0.59
name: Accuracy
- type: f1
value: 0.59
name: F1 (Weighted)
DistilBERT Goodreads Genre Predictor
This model is a fine-tuned version of 'distilbert-base-cased' trained to classify books into their respective genres based on text descriptions or summaries. It was developed as part of an end-to-end MLOps pipeline tracking system.
Model Description
- Developed by: [U E Sai Pavan Vamshi Krishna / G25AIT2149]
- Model type: Transformer-based text classification sequence model ('DistilBertForSequenceClassification')
- Language(s) (NLP): English
- License: MIT
- Finetuned from model: 'distilbert-base-cased'
Model Sources
- Repository: [Paste your GitHub Repository URL here]
- Experiment Tracking Dashboard: [Paste your Weights & Biases Project URL here]
Intended Uses & Limitations
Intended Use
This model is intended to assist in automated bookstore categorizations and library archival tasks. Given a short text block summary or back-cover description of a book, the model predicts the most relevant thematic genre.
Limitations
- The model is optimized strictly for English text. Performance may significantly degrade on non-English book summaries.
- It is constrained by DistilBERT's maximum context length window of 512 tokens. Extremely long summaries will be truncated, losing structural context near the end of the text.
How to Use
You can load and use this model directly using the Hugging Face 'transformers' library:
'''python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch
Load the model and tokenizer
model_name = "g25ait2149/distilbert-goodreads-genres" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name)
Sample text classification
text = "A thrilling space adventure tracking an astronaut stranded on a distant alien world trying to restore communications with Earth." inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad(): logits = model(**inputs).logits
predicted_class_id = logits.argmax().item() print(f"Predicted Class ID: {predicted_class_id}")
- Downloads last month
- 6