PhoBERT Fine-tuned for Vietnamese Smart Home Intent Classification
This model is a fine-tuned version of 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:
bật thiết bị
(turn on device)tắt thiết bị
(turn off device)mở thiết bị
(open device)đóng thiết bị
(close device)tăng độ sáng của thiết bị
(increase device brightness)giảm độ sáng của thiết bị
(decrease device brightness)kiểm tra tình trạng thiết bị
(check device status)điều chỉnh nhiệt độ
(adjust temperature)hẹn giờ
(set timer)kích hoạt cảnh
(activate scene)tắt tất cả thiết bị
(turn off all devices)mở khóa
(unlock)khóa
(lock)
How to Use
Using Transformers Library
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
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
# 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:
@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 or contact the authors through the university.
- Downloads last month
- 18
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Evaluation results
- Accuracy on VN-SLU Augmented Datasetself-reported98.300
- F1 Score (Weighted) on VN-SLU Augmented Datasetself-reported97.720
- F1 Score (Macro) on VN-SLU Augmented Datasetself-reported71.900