Text Classification
setfit
Safetensors
sentence-transformers
bert
generated_from_setfit_trainer
text-embeddings-inference
Instructions to use rohithbojja/intent-classification-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use rohithbojja/intent-classification-small with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("rohithbojja/intent-classification-small") - sentence-transformers
How to use rohithbojja/intent-classification-small with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("rohithbojja/intent-classification-small") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
| tags: | |
| - setfit | |
| - sentence-transformers | |
| - text-classification | |
| - generated_from_setfit_trainer | |
| widget: | |
| - text: '"I think this might be the solution."' | |
| - text: '"Oh no, I apologize!"' | |
| - text: Could you repeat that, please? | |
| - text: Oh, this is so disappointing. | |
| - text: Uhh, clear. | |
| metrics: | |
| - accuracy | |
| pipeline_tag: text-classification | |
| library_name: setfit | |
| inference: true | |
| datasets: | |
| - rbojja/zero-shot-intent-classification | |
| base_model: BAAI/bge-small-en-v1.5 | |
| # SetFit with BAAI/bge-small-en-v1.5 | |
| This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification) dataset that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. | |
| The model has been trained using an efficient few-shot learning technique that involves: | |
| 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. | |
| 2. Training a classification head with features from the fine-tuned Sentence Transformer. | |
| ## Model Details | |
| ### Model Description | |
| - **Model Type:** SetFit | |
| - **Sentence Transformer body:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | |
| - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance | |
| - **Maximum Sequence Length:** 512 tokens | |
| - **Number of Classes:** 18 classes | |
| - **Training Dataset:** [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification) | |
| <!-- - **Language:** Unknown --> | |
| <!-- - **License:** Unknown --> | |
| ### Model Sources | |
| - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) | |
| - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) | |
| - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) | |
| ### Model Labels | |
| | Label | Examples | | |
| |:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------| | |
| | 7 | <ul><li>'Oh my, this is great!'</li><li>'Oh, this is fantastic!'</li><li>'Hmm, I’m so delighted!'</li></ul> | | |
| | 3 | <ul><li>"Oh, absolutely, that's it!"</li><li>"Oh, absolutely, that's it!"</li><li>"Yep, that's exactly what I meant."</li></ul> | | |
| | 15 | <ul><li>'Really, no way?'</li><li>'Oh, that’s quite something!'</li><li>'Oh, that’s quite something!'</li></ul> | | |
| | 8 | <ul><li>"Gotcha... oh, that's clear!"</li><li>'Hmm, I see... perfect!'</li><li>'Oh, I see... clear!'</li></ul> | | |
| | 12 | <ul><li>'Uhh, fine.'</li><li>'Oh, clear.'</li><li>'Uhh, noted.'</li></ul> | | |
| | 9 | <ul><li>'Uhh, take care!'</li><li>'Hmm, see you!'</li><li>'Uhh, see you!'</li></ul> | | |
| | 17 | <ul><li>'"Umm, this could be a decent plan."'</li><li>'"I think this might be the solution."'</li><li>'"Maybe this will work out, I suppose."'</li></ul> | | |
| | 0 | <ul><li>"Why can't you just work?!"</li><li>'Seriously, this is a joke!'</li><li>'Ugh, this is so frustrating!'</li></ul> | | |
| | 6 | <ul><li>'"Oh, what if I\'m a dream?"'</li><li>'"Oh, do you speak dolphin?"'</li><li>'"Uhh, do you have a wish?"'</li></ul> | | |
| | 11 | <ul><li>"Uh-huh, that's a valid point."</li><li>'Like, I get it.'</li><li>'Right, I understand.'</li></ul> | | |
| | 16 | <ul><li>'Thank you!'</li><li>'"Hmmm, thanks, you\'re great!"'</li><li>'"Oh, fantastic, thanks a lot!"'</li></ul> | | |
| | 4 | <ul><li>"Sorry, I'm not sure."</li><li>"Well, I'm lost."</li><li>"Hmm, I'm not sure."</li></ul> | | |
| | 10 | <ul><li>'Oh, hi!'</li><li>"Hello! What's new?"</li><li>"Hi! How's life?"</li></ul> | | |
| | 13 | <ul><li>'Oh, gotcha.'</li><li>'Hmmm, okay.'</li><li>'Alright, thanks.'</li></ul> | | |
| | 2 | <ul><li>'What’s the context behind that?'</li><li>'Could you simplify that for me?'</li><li>'Can you explain that concept?'</li></ul> | | |
| | 1 | <ul><li>'"Oh, I didn’t mean to."'</li><li>'"Oops, sorry for the oversight."'</li><li>'"Oops, I’m really sorry."'</li></ul> | | |
| | 5 | <ul><li>'Oh, this is not what I wanted.'</li><li>'Oh no, this is not right.'</li><li>'Seriously, this is a failure.'</li></ul> | | |
| | 14 | <ul><li>'Uhh, superb choice!'</li><li>'Uhh, amazing decision!'</li><li>'Oh, superb performance!'</li></ul> | | |
| ## Uses | |
| ### Direct Use for Inference | |
| First install the SetFit library: | |
| ```bash | |
| pip install setfit | |
| ``` | |
| Then you can load this model and run inference. | |
| ```python | |
| from setfit import SetFitModel | |
| # Download from the 🤗 Hub | |
| model = SetFitModel.from_pretrained("rbojja/intent-classification-small") | |
| # Run inference | |
| preds = model("Uhh, clear.") | |
| ``` | |
| <!-- | |
| ### Downstream Use | |
| *List how someone could finetune this model on their own dataset.* | |
| --> | |
| <!-- | |
| ### Out-of-Scope Use | |
| *List how the model may foreseeably be misused and address what users ought not to do with the model.* | |
| --> | |
| <!-- | |
| ## Bias, Risks and Limitations | |
| *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.* | |
| --> | |
| <!-- | |
| ### Recommendations | |
| *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.* | |
| --> | |
| ## Training Details | |
| ### Training Set Metrics | |
| | Training set | Min | Median | Max | | |
| |:-------------|:----|:-------|:----| | |
| | Word count | 2 | 4.2224 | 9 | | |
| | Label | Training Sample Count | | |
| |:------|:----------------------| | |
| | 0 | 40 | | |
| | 1 | 40 | | |
| | 2 | 37 | | |
| | 3 | 40 | | |
| | 4 | 41 | | |
| | 5 | 38 | | |
| | 6 | 42 | | |
| | 7 | 38 | | |
| | 8 | 35 | | |
| | 9 | 39 | | |
| | 10 | 42 | | |
| | 11 | 41 | | |
| | 12 | 42 | | |
| | 13 | 44 | | |
| | 14 | 38 | | |
| | 15 | 43 | | |
| | 16 | 47 | | |
| | 17 | 37 | | |
| ### Training Hyperparameters | |
| - batch_size: (16, 2) | |
| - num_epochs: (1, 16) | |
| - max_steps: -1 | |
| - sampling_strategy: oversampling | |
| - num_iterations: 20 | |
| - body_learning_rate: (2e-05, 1e-05) | |
| - head_learning_rate: 0.01 | |
| - loss: CosineSimilarityLoss | |
| - distance_metric: cosine_distance | |
| - margin: 0.25 | |
| - end_to_end: False | |
| - use_amp: False | |
| - warmup_proportion: 0.1 | |
| - l2_weight: 0.01 | |
| - seed: 42 | |
| - eval_max_steps: -1 | |
| - load_best_model_at_end: False | |
| ### Training Results | |
| | Epoch | Step | Training Loss | Validation Loss | | |
| |:------:|:----:|:-------------:|:---------------:| | |
| | 0.0006 | 1 | 0.149 | - | | |
| | 0.0276 | 50 | 0.1836 | - | | |
| | 0.0552 | 100 | 0.1408 | - | | |
| | 0.0829 | 150 | 0.0978 | - | | |
| | 0.1105 | 200 | 0.0805 | - | | |
| | 0.1381 | 250 | 0.0684 | - | | |
| | 0.1657 | 300 | 0.0594 | - | | |
| | 0.1934 | 350 | 0.051 | - | | |
| | 0.2210 | 400 | 0.0383 | - | | |
| | 0.2486 | 450 | 0.0379 | - | | |
| | 0.2762 | 500 | 0.035 | - | | |
| | 0.3039 | 550 | 0.0334 | - | | |
| | 0.3315 | 600 | 0.0306 | - | | |
| | 0.3591 | 650 | 0.0266 | - | | |
| | 0.3867 | 700 | 0.0264 | - | | |
| | 0.4144 | 750 | 0.018 | - | | |
| | 0.4420 | 800 | 0.0193 | - | | |
| | 0.4696 | 850 | 0.0166 | - | | |
| | 0.4972 | 900 | 0.0165 | - | | |
| | 0.5249 | 950 | 0.016 | - | | |
| | 0.5525 | 1000 | 0.0177 | - | | |
| | 0.5801 | 1050 | 0.0202 | - | | |
| | 0.6077 | 1100 | 0.0133 | - | | |
| | 0.6354 | 1150 | 0.014 | - | | |
| | 0.6630 | 1200 | 0.013 | - | | |
| | 0.6906 | 1250 | 0.0161 | - | | |
| | 0.7182 | 1300 | 0.0119 | - | | |
| | 0.7459 | 1350 | 0.0132 | - | | |
| | 0.7735 | 1400 | 0.0131 | - | | |
| | 0.8011 | 1450 | 0.0123 | - | | |
| | 0.8287 | 1500 | 0.0115 | - | | |
| | 0.8564 | 1550 | 0.0111 | - | | |
| | 0.8840 | 1600 | 0.011 | - | | |
| | 0.9116 | 1650 | 0.01 | - | | |
| | 0.9392 | 1700 | 0.0098 | - | | |
| | 0.9669 | 1750 | 0.0142 | - | | |
| | 0.9945 | 1800 | 0.0132 | - | | |
| ### Framework Versions | |
| - Python: 3.11.11 | |
| - SetFit: 1.1.1 | |
| - Sentence Transformers: 3.3.1 | |
| - Transformers: 4.47.1 | |
| - PyTorch: 2.5.1+cu121 | |
| - Datasets: 3.2.0 | |
| - Tokenizers: 0.21.0 | |
| ## Citation | |
| ### BibTeX | |
| ```bibtex | |
| @article{https://doi.org/10.48550/arxiv.2209.11055, | |
| doi = {10.48550/ARXIV.2209.11055}, | |
| url = {https://arxiv.org/abs/2209.11055}, | |
| author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren}, | |
| keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences}, | |
| title = {Efficient Few-Shot Learning Without Prompts}, | |
| publisher = {arXiv}, | |
| year = {2022}, | |
| copyright = {Creative Commons Attribution 4.0 International} | |
| } | |
| ``` | |
| <!-- | |
| ## Glossary | |
| *Clearly define terms in order to be accessible across audiences.* | |
| --> | |
| <!-- | |
| ## Model Card Authors | |
| *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* | |
| --> | |
| <!-- | |
| ## Model Card Contact | |
| *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* | |
| --> |