Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- bert
|
| 5 |
+
- deberta
|
| 6 |
+
- text-classification
|
| 7 |
+
- fine-tuned
|
| 8 |
+
- databricks-dolly
|
| 9 |
+
- prompt-category
|
| 10 |
+
language: en
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# π§ DeBERTa-v3 Base - Prompt Category Classifier (Fine-tuned)
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned version of [`microsoft/deberta-v3-base`](https://huggingface.co/microsoft/deberta-v3-base) on a modified version of the [databricks-dolly-15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k) dataset.
|
| 16 |
+
It has been trained to classify the **prompt category** based solely on the **response** text.
|
| 17 |
+
|
| 18 |
+
## ποΈ Task
|
| 19 |
+
|
| 20 |
+
**Text Classification**
|
| 21 |
+
**Input**: Response text from a human-annotated prompt
|
| 22 |
+
**Output**: One of the predefined categories such as:
|
| 23 |
+
- `brainstorming`
|
| 24 |
+
- `classification`
|
| 25 |
+
- `closed_qa`
|
| 26 |
+
- `creative_writing`
|
| 27 |
+
- `general_qa`
|
| 28 |
+
- `information_extraction`
|
| 29 |
+
- `open_qa`
|
| 30 |
+
- `summarization`
|
| 31 |
+
|
| 32 |
+
## π Evaluation
|
| 33 |
+
|
| 34 |
+
The model was evaluated on a balanced version of the dataset. Here are the results:
|
| 35 |
+
|
| 36 |
+
- **Validation Accuracy**: ~85.5%
|
| 37 |
+
- **F1 Score**: ~85.0%
|
| 38 |
+
- Best performance on: `creative_writing`, `classification`, `summarization`
|
| 39 |
+
- Room for improvement on: `open_qa`
|
| 40 |
+
|
| 41 |
+
## π§ͺ How to Use
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 45 |
+
import torch
|
| 46 |
+
|
| 47 |
+
model = AutoModelForSequenceClassification.from_pretrained("mariadg/deberta-v3-category-classifier")
|
| 48 |
+
tokenizer = AutoTokenizer.from_pretrained("mariadg/deberta-v3-category-classifier")
|
| 49 |
+
|
| 50 |
+
text = "The mitochondria is known as the powerhouse of the cell."
|
| 51 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
| 52 |
+
outputs = model(**inputs)
|
| 53 |
+
pred = torch.argmax(outputs.logits, dim=1).item()
|
| 54 |
+
|
| 55 |
+
print(pred) # Map this index back to label if needed
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## π οΈ Training Details
|
| 59 |
+
|
| 60 |
+
- **Base model**: `microsoft/deberta-v3-base`
|
| 61 |
+
- **Framework**: PyTorch
|
| 62 |
+
- **Max length**: 256
|
| 63 |
+
- **Batch size**: 16
|
| 64 |
+
- **Epochs**: 4
|
| 65 |
+
- **Loss function**: `CrossEntropyLoss`
|
| 66 |
+
|
| 67 |
+
## π License
|
| 68 |
+
|
| 69 |
+
Apache 2.0
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
π Fine-tuned by [mariadg](https://huggingface.co/mariadg) β for research purposes.
|