File size: 1,227 Bytes
bc9815b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# RoBERTa Style Classifier
This is a fine-tuned [`roberta-base`](https://huggingface.co/roberta-base) model for **writing style classification**.
## 🔍 Task
Given an input sentence, the model predicts the most appropriate **writing style** such as:
- Empathetic
- Formal
- Casual
- Persuasive
- Technical
- ... and more
## 🧠 Model Details
- Base model: `roberta-base`
- Max length: 256 tokens
- Trained using PyTorch and Hugging Face Transformers
- Dataset: Custom curated and balanced dataset with 10+ writing styles
## 📊 Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model = AutoModelForSequenceClassification.from_pretrained("Akshay-Sai/roberta-style-classifier")
tokenizer = AutoTokenizer.from_pretrained("Akshay-Sai/roberta-style-classifier")
def predict_style(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
pred = torch.argmax(outputs.logits, dim=1)
return model.config.id2label[pred.item()]
# Example
text = "I understand how tough this must be for you. Stay strong."
print("Predicted Style:", predict_style(text))
|