Instructions to use cngchis/phi4-mini-intent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cngchis/phi4-mini-intent with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="cngchis/phi4-mini-intent")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cngchis/phi4-mini-intent") model = AutoModelForCausalLM.from_pretrained("cngchis/phi4-mini-intent") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,4 +14,106 @@ base_model:
|
|
| 14 |
new_version: cngchis/phi4-mini-intent
|
| 15 |
pipeline_tag: text-classification
|
| 16 |
library_name: transformers
|
| 17 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
new_version: cngchis/phi4-mini-intent
|
| 15 |
pipeline_tag: text-classification
|
| 16 |
library_name: transformers
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Intent Classification Model
|
| 20 |
+
|
| 21 |
+
## Model Description
|
| 22 |
+
|
| 23 |
+
This repository contains a **fine-tuned Transformer model** for **intent classification**.
|
| 24 |
+
|
| 25 |
+
The model is built using Hugging Face `transformers` and stored in **safetensors format**, enabling efficient and safe loading.
|
| 26 |
+
|
| 27 |
+
It predicts an intent label from input text for tasks such as chatbot understanding, ticket routing, and text categorization.
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## How to Use
|
| 32 |
+
|
| 33 |
+
### Install dependencies
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
pip install transformers torch
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
### Load model
|
| 42 |
+
```bash
|
| 43 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 44 |
+
import torch
|
| 45 |
+
|
| 46 |
+
model_path = "cngchis/phi4-mini-intent"
|
| 47 |
+
|
| 48 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 49 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 50 |
+
|
| 51 |
+
text = "I cannot log into my account"
|
| 52 |
+
|
| 53 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
| 54 |
+
|
| 55 |
+
with torch.no_grad():
|
| 56 |
+
outputs = model(**inputs)
|
| 57 |
+
|
| 58 |
+
logits = outputs.logits
|
| 59 |
+
predicted_class = torch.argmax(logits, dim=1).item()
|
| 60 |
+
|
| 61 |
+
print(predicted_class)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
### Input Format (Recommended)
|
| 67 |
+
|
| 68 |
+
```json
|
| 69 |
+
"I want to reset my password"
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
### Output Format
|
| 75 |
+
|
| 76 |
+
The model outputs a class index, which can be mapped to intent labels:
|
| 77 |
+
|
| 78 |
+
```json
|
| 79 |
+
3 → password_reset
|
| 80 |
+
1 → login_issue
|
| 81 |
+
5 → payment_problem
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
(You should define label mapping in your application.)
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
### Model Details
|
| 89 |
+
|
| 90 |
+
Architecture: Transformer-based classification model
|
| 91 |
+
Task: Intent classification
|
| 92 |
+
Format: PyTorch (safetensors)
|
| 93 |
+
Library: Hugging Face Transformers
|
| 94 |
+
Input: Natural language text
|
| 95 |
+
Output: Single intent class
|
| 96 |
+
Notes
|
| 97 |
+
Best performance when input format matches training data
|
| 98 |
+
Requires label mapping for interpretation
|
| 99 |
+
Works with GPU
|
| 100 |
+
Supports batch inference via Transformers
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
### Limitations
|
| 105 |
+
|
| 106 |
+
Not suitable for generative tasks
|
| 107 |
+
Sensitive to domain shift (out-of-distribution text)
|
| 108 |
+
Requires consistent intent label schema
|
| 109 |
+
|
| 110 |
+
---
|
| 111 |
+
|
| 112 |
+
### Acknowledgements
|
| 113 |
+
|
| 114 |
+
Built using:
|
| 115 |
+
|
| 116 |
+
Hugging Face Transformers
|
| 117 |
+
PyTorch
|
| 118 |
+
Safetensors format
|
| 119 |
+
|