Text Classification
Transformers
ONNX
Safetensors
English
Hindi
distilbert
int8
query-classification
generic-semantic
multilingual
Eval Results (legacy)
Instructions to use addyo07/distilbert-query-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use addyo07/distilbert-query-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="addyo07/distilbert-query-classifier")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("addyo07/distilbert-query-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload scripts/config.py with huggingface_hub
Browse files- scripts/config.py +37 -0
scripts/config.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Configuration for the Generic vs Semantic classifier project."""
|
| 2 |
+
|
| 3 |
+
# Paths
|
| 4 |
+
DATA_DIR = "data"
|
| 5 |
+
RAW_DIR = f"{DATA_DIR}/raw"
|
| 6 |
+
PROCESSED_DIR = f"{DATA_DIR}/processed"
|
| 7 |
+
MODELS_DIR = "models"
|
| 8 |
+
SCRIPTS_DIR = "scripts"
|
| 9 |
+
|
| 10 |
+
# Dataset
|
| 11 |
+
TOTAL_PER_CATEGORY = 3000
|
| 12 |
+
BATCH_SIZE_GEN = 50 # examples per Ollama API call
|
| 13 |
+
MAX_CONCURRENT = 8 # parallel API requests
|
| 14 |
+
|
| 15 |
+
# Categories
|
| 16 |
+
CATEGORIES = {
|
| 17 |
+
"en_generic": {"lang": "English", "label": "GENERIC"},
|
| 18 |
+
"en_semantic": {"lang": "English", "label": "SEMANTIC"},
|
| 19 |
+
"hi_generic": {"lang": "Hindi", "label": "GENERIC"},
|
| 20 |
+
"hi_semantic": {"lang": "Hindi", "label": "SEMANTIC"},
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# Model
|
| 24 |
+
MODEL_NAME = "distilbert-base-multilingual-cased"
|
| 25 |
+
MAX_SEQ_LEN = 64
|
| 26 |
+
NUM_LABELS = 2
|
| 27 |
+
LABEL_MAP = {"GENERIC": 0, "SEMANTIC": 1}
|
| 28 |
+
|
| 29 |
+
# Training
|
| 30 |
+
BATCH_SIZE = 32
|
| 31 |
+
LEARNING_RATE = 2e-5
|
| 32 |
+
NUM_EPOCHS = 5
|
| 33 |
+
TEST_SPLIT = 0.15
|
| 34 |
+
|
| 35 |
+
# Ollama
|
| 36 |
+
OLLAMA_URL = "http://localhost:11434/api/chat"
|
| 37 |
+
OLLAMA_MODEL = "llama3.1:8b-instruct-q4_K_M"
|