--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: Tiong Bahru Plaza, DDC-L2-5, AHU-L2-03 trip alarm - text: 'Tiong Bahru Plaza, DDC L4-1, PAU-L4-03 supply air temperature (Units: °C).2' - text: Tiong Bahru Plaza, DDC-L20, AHU 20-1 VSD CONTROL - text: 'Tiong Bahru Plaza, VAV 19-7, Discharge Air Flow (Units: m3/h)' - text: Tiong Bahru Plaza, DDC-L2-5, PAU-L2-02 VSD control pipeline_tag: text-classification inference: true base_model: sentence-transformers/paraphrase-MiniLM-L3-v2 model-index: - name: SetFit with sentence-transformers/paraphrase-MiniLM-L3-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.9863861386138614 name: Accuracy --- # SetFit with sentence-transformers/paraphrase-MiniLM-L3-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-MiniLM-L3-v2](https://huggingface.co/sentence-transformers/paraphrase-MiniLM-L3-v2) 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:** [sentence-transformers/paraphrase-MiniLM-L3-v2](https://huggingface.co/sentence-transformers/paraphrase-MiniLM-L3-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 128 tokens - **Number of Classes:** 44 classes ### 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 | |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 28 | | | 33 | | | 2 | | | 42 | | | 31 | | | 9 | | | 1 | | | 25 | | | 12 | | | 8 | | | 24 | | | 13 | | | 30 | | | 5 | | | 43 | | | 14 | | | 36 | | | 34 | | | 18 | | | 6 | | | 17 | | | 0 | | | 29 | | | 15 | | | 11 | | | 32 | | | 27 | | | 41 | | | 40 | | | 3 | | | 22 | | | 21 | | | 26 | | | 23 | | | 16 | | | 39 | | | 7 | | | 37 | | | 20 | | | 35 | | | 4 | | | 19 | | | 38 | | | 10 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.9864 | ## 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("Varun1010/all-MiniLM-L6-v2-polaris-more") # Run inference preds = model("Tiong Bahru Plaza, DDC-L20, AHU 20-1 VSD CONTROL") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 3 | 8.7134 | 13 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 4 | | 1 | 4 | | 2 | 4 | | 3 | 4 | | 4 | 4 | | 5 | 4 | | 6 | 4 | | 7 | 4 | | 8 | 4 | | 9 | 4 | | 10 | 4 | | 11 | 4 | | 12 | 4 | | 13 | 4 | | 14 | 4 | | 15 | 4 | | 16 | 4 | | 17 | 4 | | 18 | 4 | | 19 | 3 | | 20 | 3 | | 21 | 4 | | 22 | 4 | | 23 | 1 | | 24 | 1 | | 25 | 4 | | 26 | 4 | | 27 | 4 | | 28 | 4 | | 29 | 4 | | 30 | 3 | | 31 | 3 | | 32 | 4 | | 33 | 4 | | 34 | 4 | | 35 | 4 | | 36 | 4 | | 37 | 4 | | 38 | 3 | | 39 | 3 | | 40 | 1 | | 41 | 1 | | 42 | 3 | | 43 | 4 | ### Training Hyperparameters - batch_size: (64, 64) - num_epochs: (5, 5) - max_steps: -1 - sampling_strategy: oversampling - 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 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0027 | 1 | 0.1538 | - | | 0.1330 | 50 | 0.0495 | - | | 0.2660 | 100 | 0.0655 | - | | 0.3989 | 150 | 0.0336 | - | | 0.5319 | 200 | 0.0282 | - | | 0.6649 | 250 | 0.0207 | - | | 0.7979 | 300 | 0.0184 | - | | 0.9309 | 350 | 0.0163 | - | | 1.0638 | 400 | 0.0088 | - | | 1.1968 | 450 | 0.0307 | - | | 1.3298 | 500 | 0.0153 | - | | 1.4628 | 550 | 0.0079 | - | | 1.5957 | 600 | 0.02 | - | | 1.7287 | 650 | 0.0165 | - | | 1.8617 | 700 | 0.0087 | - | | 1.9947 | 750 | 0.0236 | - | | 2.1277 | 800 | 0.0108 | - | | 2.2606 | 850 | 0.0071 | - | | 2.3936 | 900 | 0.0137 | - | | 2.5266 | 950 | 0.0104 | - | | 2.6596 | 1000 | 0.0054 | - | | 2.7926 | 1050 | 0.0058 | - | | 2.9255 | 1100 | 0.0052 | - | | 3.0585 | 1150 | 0.0053 | - | | 3.1915 | 1200 | 0.004 | - | | 3.3245 | 1250 | 0.0047 | - | | 3.4574 | 1300 | 0.0176 | - | | 3.5904 | 1350 | 0.0046 | - | | 3.7234 | 1400 | 0.0139 | - | | 3.8564 | 1450 | 0.0043 | - | | 3.9894 | 1500 | 0.0042 | - | | 4.1223 | 1550 | 0.0112 | - | | 4.2553 | 1600 | 0.0091 | - | | 4.3883 | 1650 | 0.0045 | - | | 4.5213 | 1700 | 0.009 | - | | 4.6543 | 1750 | 0.0097 | - | | 4.7872 | 1800 | 0.0049 | - | | 4.9202 | 1850 | 0.0036 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.6.1 - Transformers: 4.38.2 - PyTorch: 2.2.1+cu121 - Datasets: 2.18.0 - Tokenizers: 0.15.2 ## 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} } ```