Downloads · 30 days
7
25% of all-time downloads
Mitchins/literary-tone-classifier-v0.1
literary-tone-classifier-v0.1 is a machine learning model from Mitchins. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A DeBERTa-based classifier for detecting emotional tone in literary fiction passages. Designed for commercial fiction filtering and training data curation.
Downloads · 30 days
7
25% of all-time downloads
All-time downloads
28
Public
Parameters
142M
570 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors568 MB · 98%
From the Hugging Face model README
A DeBERTa-based classifier for detecting emotional tone in literary fiction passages. Designed for commercial fiction filtering and training data curation.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "Mitchins/literary-tone-classifier-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = """Your literary passage here..."""
inputs = tokenizer(text, max_length=2048, truncation=True,
padding='max_length', return_tensors='pt')
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)[0]
tones = ['dark', 'humorous', 'lyrical', 'melancholic', 'warm']
for tone, score in zip(tones, probs):
print(f"{tone}: {score:.2%}")
The model predicts 5 emotional tone categories:
| Class | What It Detects | Validation F1 | Typical Use |
|---|---|---|---|
| dark | Grim, violent, oppressive, noir | 91.1% | Filter grimdark fantasy, horror, noir |
| humorous | Satirical, witty, comedic | 91.1% | Filter comedy, satire, lighthearted fiction |
| warm | Comforting, affectionate, uplifting | 94.2% | Filter romance, cozy mysteries |
| melancholic | Sad, loss-focused, bittersweet | 88.7% | Filter emotional drama, literary fiction |
| lyrical | Poetic prose, metaphorical | 90.5% | Identify literary/poetic writing style |
The model works best when interpreted as a commercial fiction filter:
# Recommended interpretation
if probs[tones.index('humorous')] >= 0.60:
category = "Comedy/Satire" # 98% precision - very reliable
elif probs[tones.index('dark')] >= 0.60:
category = "Grim/Horror" # 88% precision - reliable
elif probs[tones.index('warm')] >= 0.70 or probs[tones.index('melancholic')] >= 0.70:
category = "Heartfelt/Emotional" # Combine for relationship-focused fiction
else:
category = "Neutral" # Likely action/thriller/plot-driven
✅ Dark/Grim (grimdark fantasy, noir, horror)
✅ Humorous (comedy, satire)
✅ Warm (romance, cozy)
✅ Melancholic (drama, loss)
⚠️ Lyrical class has narrow application
⚠️ Cannot detect pacing
⚠️ Limited testing on some categories
⚠️ Edge cases
Based on validation precision:
| Tone | Conservative | Balanced | Aggressive |
|---|---|---|---|
| dark | ≥0.75 | ≥0.65 | ≥0.55 |
| humorous | ≥0.70 | ≥0.60 | ≥0.50 |
| warm/melancholic | ≥0.80 | ≥0.70 | ≥0.60 |
Higher thresholds = fewer false positives, lower recall.
dark_passages = []
for passage in corpus:
inputs = tokenizer(passage, max_length=2048, truncation=True,
padding='max_length', return_tensors='pt')
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)[0]
if probs[0] >= 0.65: # dark threshold
dark_passages.append((passage, probs[0].item()))
# Expected precision: ~85%
# Very high precision due to conservative model
if probs[1] >= 0.60: # humorous threshold
comedy_passages.append(passage)
# Expected precision: ~95%+
# Use lyrical score as prose density indicator
if probs[2] >= 0.20: # lyrical threshold
literary_style = "poetic/metaphorical"
else:
literary_style = "commercial/invisible"
❌ Don't use for:
❌ Known failure modes:
Previous 12-tone model:
This 5-tone model v0.1:
Planned improvements:
@misc{literary-tone-v0.1,
title={Literary Tone Classifier v0.1},
author={Your Name},
year={2025},
howpublished={HuggingFace Model Hub}
}
Model weights: [Your chosen license] Base model (DeBERTa): MIT License
For issues or questions about this model, please open an issue on the model repository.
Note: This is v0.1 - a working prototype optimized for dark and humorous detection. Some categories (warm, melancholic, lyrical) need additional validation on diverse published fiction before production use in all scenarios.