Instructions to use hopjetair/intent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use hopjetair/intent with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("<base-model-id>") model.load_adapter("hopjetair/intent", set_active=True) - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DistilBERT with LoRA for Intent Recognition
|
| 2 |
+
|
| 3 |
+
This is a parameter-efficient fine-tuned version of `distilbert-base-uncased` using the LoRA technique via [PEFT](https://github.com/huggingface/peft). The model was trained for intent recognition using a custom dataset.
|
| 4 |
+
|
| 5 |
+
## 🧾 Model Details
|
| 6 |
+
- Base model: `distilbert-base-uncased`
|
| 7 |
+
- Fine-tuning method: [LoRA (Low-Rank Adaptation)](https://arxiv.org/abs/2106.09685) using 🤗 PEFT
|
| 8 |
+
- Task: Intent Recognition (Text Classification)
|
| 9 |
+
|
| 10 |
+
## 🧠 Intended Use
|
| 11 |
+
You can use this model to classify user intents in applications like chatbots, virtual assistants, or voice-based interfaces.
|
| 12 |
+
|
| 13 |
+
## 📥 How to Use
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 17 |
+
from peft import PeftModel
|
| 18 |
+
|
| 19 |
+
# Load tokenizer and base model
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained("hopjetair/intent")
|
| 21 |
+
base_model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased",num_labels=33)
|
| 22 |
+
|
| 23 |
+
# Load LoRA adapter
|
| 24 |
+
model = PeftModel.from_pretrained(base_model, "hopjetair/intent")
|
| 25 |
+
|
| 26 |
+
# Inference
|
| 27 |
+
text = "Book me a flight to New York"
|
| 28 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 29 |
+
outputs = model(**inputs)
|
| 30 |
+
intent_class = outputs.logits.argmax(dim=1).item()
|