Downloads · 30 days
23
26% of all-time downloads
lanretto/shakespeare-authenticator-pytorch
shakespeare-authenticator-pytorch is a text classification model from lanretto. Use it when you need a label for a piece of text. It is set up for pytorch. The card lists the license as mit.
This is a PyTorch manual implementation of the Shakespeare Authenticator model, distinguishing between authentic Shakespearean text and modern writing. This model was built from scratch using raw PyTorch (without Hugg…
Downloads · 30 days
23
26% of all-time downloads
All-time downloads
87
Public
Repo size
876 MB
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This is a PyTorch manual implementation of the Shakespeare Authenticator model, distinguishing between authentic Shakespearean text and modern writing. This model was built from scratch using raw PyTorch (without Hugging Face Trainer) for educational purposes.
| Metric | Value |
|---|---|
| Accuracy | 0.9835 |
| F1-Score | 0.9685 |
| Test Samples | 40,626 |
| Avg Confidence | 0.9938 |
| Model | Accuracy | F1-Score |
|---|---|---|
| Original (HF Trainer) | 0.9820 | 0.9658 |
| PyTorch Manual | 0.9835 | 0.9685 |
class ShakespeareClassifier(nn.Module):
def __init__(self, bert_model, num_classes=2, dropout_rate=0.1):
super().__init__()
self.bert = bert_model
self.dropout = nn.Dropout(dropout_rate)
self.classifier = nn.Linear(768, num_classes)
def forward(self, input_ids, attention_mask):
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
pooled_output = outputs.pooler_output
x = self.dropout(pooled_output)
logits = self.classifier(x)
return logits