Upload 7 files
Browse filesFiles changed (7)
- README.mdAdded+97
- config.jsonAdded+182
- model.safetensorsAdded+3
- special_tokens_map.jsonAdded+7
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+56
- vocab.txtAdded
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697# DistilBERT-Based Intent Detection Model for Banking Customer Queries
This repository contains a fine-tuned **DistilBERT** model for **intent detection** in banking customer support scenarios. It is trained on the **BANKING77 dataset** and designed to accurately classify user queries into 77 distinct banking-related intents.
## Model Details
- **Model Architecture:** DistilBERT Base Uncased - **Task:** Intent Detection for Banking Queries - **Dataset:** [BANKING77](https://huggingface.co/datasets/banking77) - **Fine-tuning Framework:** Hugging Face Transformers - **Language:** English - **Number of Labels:** 77 - **Quantization:** *Not applied (full precision)*
## Usage
### Installation
```bashpip install transformers torch datasets```
### Loading the Model
```pythonfrom transformers import DistilBertTokenizer, DistilBertForSequenceClassificationimport torch
# Load fine-tuned modelmodel_path = "./banking77-distilbert" # Adjust path if differentmodel = DistilBertForSequenceClassification.from_pretrained(model_path)tokenizer = DistilBertTokenizer.from_pretrained(model_path)model.eval()
# Sample querytext = "I need to reset my online banking password."
# Tokenize and predictinputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)with torch.no_grad(): outputs = model(**inputs)predicted_class = torch.argmax(outputs.logits, dim=1).item()
# Example label map (replace with the full BANKING77 map)label_map = {0: "activate_my_card", 1: "balance", 2: "card_arrival", ..., 76: "why_was_my_card_declined"}print(f"Predicted Intent: {label_map[predicted_class]}")```
## Performance Metrics
- **Accuracy:** ~95% (on the BANKING77 test split) - **Loss:** ~0.13 (after fine-tuning for 4 epochs)
## Fine-Tuning Details
### Dataset
- **Name:** BANKING77 - **Size:** ~13,000 customer support queries - **Intents:** 77 unique labeled banking intents
### Training
- **Epochs:** 4 - **Batch Size:** 16 - **Learning Rate:** 2e-5 - **Optimizer:** AdamW - **Evaluation Strategy:** per epoch - **Loss Function:** CrossEntropyLoss
### Hardware
- **GPU Used:** NVIDIA Tesla T4 (via Google Colab) - **Training Time:** ~15 minutes
## Repository Structure
```.├── banking77-distilbert/ # Fine-tuned model directory (saved via trainer.save_model)│ ├── config.json│ ├── pytorch_model.bin│ ├── tokenizer_config.json│ ├── vocab.txt├── intent_predictor.py # Script for predicting intents (with preprocessing)├── README.md # Model documentation```
## Limitations
- The model is trained only on banking-related intents; it may misclassify out-of-domain queries.- Multilingual support is not included — limited to English.- Model does not handle multiple intents per query.
## Contributing
Contributions and suggestions are welcome. Please open an issue or pull request for improvements or additional features.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182{ "activation": "gelu", "architectures": [ "DistilBertForSequenceClassification" ], "attention_dropout": 0.1, "dim": 768, "dropout": 0.1, "hidden_dim": 3072, "id2label": { "0": "LABEL_0", "1": "LABEL_1", "2": "LABEL_2", "3": "LABEL_3", "4": "LABEL_4", "5": "LABEL_5", "6": "LABEL_6", "7": "LABEL_7", "8": "LABEL_8", "9": "LABEL_9", "10": "LABEL_10", "11": "LABEL_11", "12": "LABEL_12", "13": "LABEL_13", "14": "LABEL_14", "15": "LABEL_15", "16": "LABEL_16", "17": "LABEL_17", "18": "LABEL_18", "19": "LABEL_19", "20": "LABEL_20", "21": "LABEL_21", "22": "LABEL_22", "23": "LABEL_23", "24": "LABEL_24", "25": "LABEL_25", "26": "LABEL_26", "27": "LABEL_27", "28": "LABEL_28", "29": "LABEL_29", "30": "LABEL_30", "31": "LABEL_31", "32": "LABEL_32", "33": "LABEL_33", "34": "LABEL_34", "35": "LABEL_35", "36": "LABEL_36", "37": "LABEL_37", "38": "LABEL_38", "39": "LABEL_39", "40": "LABEL_40", "41": "LABEL_41", "42": "LABEL_42", "43": "LABEL_43", "44": "LABEL_44", "45": "LABEL_45", "46": "LABEL_46", "47": "LABEL_47", "48": "LABEL_48", "49": "LABEL_49", "50": "LABEL_50", "51": "LABEL_51", "52": "LABEL_52", "53": "LABEL_53", "54": "LABEL_54", "55": "LABEL_55", "56": "LABEL_56", "57": "LABEL_57", "58": "LABEL_58", "59": "LABEL_59", "60": "LABEL_60", "61": "LABEL_61", "62": "LABEL_62", "63": "LABEL_63", "64": "LABEL_64", "65": "LABEL_65", "66": "LABEL_66", "67": "LABEL_67", "68": "LABEL_68", "69": "LABEL_69", "70": "LABEL_70", "71": "LABEL_71", "72": "LABEL_72", "73": "LABEL_73", "74": "LABEL_74", "75": "LABEL_75", "76": "LABEL_76" }, "initializer_range": 0.02, "label2id": { "LABEL_0": 0, "LABEL_1": 1, "LABEL_10": 10, "LABEL_11": 11, "LABEL_12": 12, "LABEL_13": 13, "LABEL_14": 14, "LABEL_15": 15, "LABEL_16": 16, "LABEL_17": 17, "LABEL_18": 18, "LABEL_19": 19, "LABEL_2": 2, "LABEL_20": 20, "LABEL_21": 21, "LABEL_22": 22, "LABEL_23": 23, "LABEL_24": 24, "LABEL_25": 25, "LABEL_26": 26, "LABEL_27": 27, "LABEL_28": 28, "LABEL_29": 29, "LABEL_3": 3, "LABEL_30": 30, "LABEL_31": 31, "LABEL_32": 32, "LABEL_33": 33, "LABEL_34": 34, "LABEL_35": 35, "LABEL_36": 36, "LABEL_37": 37, "LABEL_38": 38, "LABEL_39": 39, "LABEL_4": 4, "LABEL_40": 40, "LABEL_41": 41, "LABEL_42": 42, "LABEL_43": 43, "LABEL_44": 44, "LABEL_45": 45, "LABEL_46": 46, "LABEL_47": 47, "LABEL_48": 48, "LABEL_49": 49, "LABEL_5": 5, "LABEL_50": 50, "LABEL_51": 51, "LABEL_52": 52, "LABEL_53": 53, "LABEL_54": 54, "LABEL_55": 55, "LABEL_56": 56, "LABEL_57": 57, "LABEL_58": 58, "LABEL_59": 59, "LABEL_6": 6, "LABEL_60": 60, "LABEL_61": 61, "LABEL_62": 62, "LABEL_63": 63, "LABEL_64": 64, "LABEL_65": 65, "LABEL_66": 66, "LABEL_67": 67, "LABEL_68": 68, "LABEL_69": 69, "LABEL_7": 7, "LABEL_70": 70, "LABEL_71": 71, "LABEL_72": 72, "LABEL_73": 73, "LABEL_74": 74, "LABEL_75": 75, "LABEL_76": 76, "LABEL_8": 8, "LABEL_9": 9 }, "max_position_embeddings": 512, "model_type": "distilbert", "n_heads": 12, "n_layers": 6, "pad_token_id": 0, "problem_type": "single_label_classification", "qa_dropout": 0.1, "seq_classif_dropout": 0.2, "sinusoidal_pos_embds": false, "tie_weights_": true, "torch_dtype": "float16", "transformers_version": "4.51.3", "vocab_size": 30522}123version https://git-lfs.github.com/spec/v1oid sha256:5e70689cad41f7376b742f45cbc2d6a65ab2b0c148805704b47544c810842682size 1340377941234567{ "cls_token": "[CLS]", "mask_token": "[MASK]", "pad_token": "[PAD]", "sep_token": "[SEP]", "unk_token": "[UNK]"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556{ "added_tokens_decoder": { "0": { "content": "[PAD]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "100": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "101": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "102": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "103": { "content": "[MASK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "clean_up_tokenization_spaces": false, "cls_token": "[CLS]", "do_lower_case": true, "extra_special_tokens": {}, "mask_token": "[MASK]", "model_max_length": 512, "pad_token": "[PAD]", "sep_token": "[SEP]", "strip_accents": null, "tokenize_chinese_chars": true, "tokenizer_class": "DistilBertTokenizer", "unk_token": "[UNK]"}README.mdAdded+97
config.jsonAdded+182
model.safetensorsAdded+3
special_tokens_map.jsonAdded+7
tokenizer.jsonAdded
tokenizer_config.jsonAdded+56
vocab.txtAdded