File size: 4,916 Bytes
1331269 fbbed0f 1331269 e89f307 1331269 |
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
---
language: vi
tags:
- intent-classification
- smart-home
- vietnamese
- phobert
license: mit
datasets:
- custom-vn-slu-augmented
metrics:
- accuracy
- f1
model-index:
- name: PhoBERT Intent Classifier for Vietnamese Smart Home
results:
- task:
type: text-classification
name: Intent Classification
dataset:
name: VN-SLU Augmented Dataset
type: custom
metrics:
- type: accuracy
value: 98.3
name: Accuracy
- type: f1
value: 97.72
name: F1 Score (Weighted)
- type: f1
value: 71.90
name: F1 Score (Macro)
widget:
- text: "bật đèn phòng khách"
- text: "tắt quạt phòng ngủ lúc 10 giờ tối"
- text: "kiểm tra tình trạng điều hòa"
- text: "tăng độ sáng đèn bàn"
- text: "mở cửa chính"
---
# PhoBERT Fine-tuned for Vietnamese Smart Home Intent Classification
This model is a fine-tuned version of [vinai/phobert-base](https://huggingface.co/vinai/phobert-base) specifically trained for intent classification in Vietnamese smart home commands.
## Model Description
- **Base Model**: vinai/phobert-base
- **Task**: Intent Classification for Smart Home Commands
- **Language**: Vietnamese
- **Number of Intent Classes**: 13
## Intended Uses & Limitations
### Intended Uses
- Classifying user intents in Vietnamese smart home voice commands
- Integration with voice assistants for home automation
- Research in Vietnamese NLP for IoT applications
### Limitations
- Optimized specifically for smart home domain
- May not generalize well to other domains
- Trained on Vietnamese language only
## Intent Classes
The model can classify the following 13 intents:
1. `bật thiết bị` (turn on device)
2. `tắt thiết bị` (turn off device)
3. `mở thiết bị` (open device)
4. `đóng thiết bị` (close device)
5. `tăng độ sáng của thiết bị` (increase device brightness)
6. `giảm độ sáng của thiết bị` (decrease device brightness)
7. `kiểm tra tình trạng thiết bị` (check device status)
8. `điều chỉnh nhiệt độ` (adjust temperature)
9. `hẹn giờ` (set timer)
10. `kích hoạt cảnh` (activate scene)
11. `tắt tất cả thiết bị` (turn off all devices)
12. `mở khóa` (unlock)
13. `khóa` (lock)
## How to Use
### Using Transformers Library
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import pickle
# Load model and tokenizer
model_name = "ntgiaky/phobert-intent-classifier-smart-home"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Load label encoder
with open('intent_encoder.pkl', 'rb') as f:
label_encoder = pickle.load(f)
# Predict intent
def predict_intent(text):
# Tokenize
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
# Predict
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1)
# Decode label
intent = label_encoder.inverse_transform(predicted_class.cpu().numpy())[0]
confidence = predictions[0][predicted_class].item()
return intent, confidence
# Example usage
text = "bật đèn phòng khách"
intent, confidence = predict_intent(text)
print(f"Intent: {intent}, Confidence: {confidence:.2f}")
```
### Using Pipeline
```python
from transformers import pipeline
# Load pipeline
classifier = pipeline(
"text-classification",
model="ntgiaky/phobert-intent-classifier-smart-home",
device=0 # Use -1 for CPU
)
# Predict
result = classifier("tắt quạt phòng ngủ")
print(result)
```
## Integration Example
```python
# For Raspberry Pi deployment
import onnxruntime as ort
import numpy as np
# Convert to ONNX first (one-time)
from transformers import AutoModel
model = AutoModel.from_pretrained("ntgiaky/phobert-intent-classifier-smart-home")
# ... ONNX conversion code ...
# Then use ONNX Runtime for inference
session = ort.InferenceSession("model.onnx")
# ... inference code ...
```
## Citation
If you use this model, please cite:
```bibtex
@misc{phobert-smart-home-2025,
author = {Trần Quang Huy and Nguyễn Trần Gia Kỳ},
title = {PhoBERT Fine-tuned for Vietnamese Smart Home Intent Classification},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face Model Hub},
howpublished = {\url{https://huggingface.co/ntgiaky/intent-classifier-smart-home}}
}
```
## Authors
- **Trần Quang Huy**
- **Nguyễn Trần Gia Kỳ**
## License
This model is released under the MIT License.
## Contact
For questions or issues, please open an issue on the [model repository](https://huggingface.co/ntgiaky/phobert-intent-classifier-smart-home) or contact the authors through the university. |