Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- distilbert/distilbert-base-uncased
|
| 4 |
+
---
|
| 5 |
+
# DistilBERT for Intent Classification
|
| 6 |
+
|
| 7 |
+
## Overview
|
| 8 |
+
- **Architecture:** DistilBERT (distilbert-base-uncased) for sequence classification
|
| 9 |
+
- **Task:** Single-label intent classification of HR queries using merged user query and context
|
| 10 |
+
- **Dataset:** ~133 samples, 12 intent classes, 80/20 train/validation split
|
| 11 |
+
|
| 12 |
+
## Training Details
|
| 13 |
+
- **Epochs:** 5
|
| 14 |
+
- **Batch Size:** 8
|
| 15 |
+
- **Learning Rate:** 5e-5
|
| 16 |
+
- **Optimizer:** AdamW
|
| 17 |
+
- **Loss:** CrossEntropyLoss
|
| 18 |
+
|
| 19 |
+
## Evaluation Metrics (Validation Set)
|
| 20 |
+
| Metric | Value |
|
| 21 |
+
|------------|----------|
|
| 22 |
+
| Accuracy | 88.89% |
|
| 23 |
+
| Precision | 100% |
|
| 24 |
+
| Recall | 88.89% |
|
| 25 |
+
| Loss | 1.4586 |
|
| 26 |
+
|
| 27 |
+
## Usage Example
|
| 28 |
+
text = "Share offer with Santhosh [context: {domain: HR, topic: onboarding, subject: offer letter}]"
|
| 29 |
+
inputs = tokenizer(text, return_tensors='pt', truncation=True, padding=True)
|
| 30 |
+
with torch.no_grad():
|
| 31 |
+
logits = model(**inputs).logits
|
| 32 |
+
pred_id = logits.argmax(dim=1).item()
|
| 33 |
+
|
| 34 |
+
## Comments
|
| 35 |
+
- Consistent strong results on validation set.
|
| 36 |
+
- Model is robust for HR chatbot/automation intent tasks.
|
| 37 |
+
- Consider more data or further tuning for additional improvement.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
*For best results, ensure your production inference pipeline preprocesses and tokenizes input exactly as done for the training data.*
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
**In summary:**
|
| 46 |
+
You’ve followed the right steps for distilbert-based intent classification and your documentation—combined with this detailed evaluation/usage section—will be clear and informative for anyone using your model!
|