--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: Board Meeting Outcome for Scheme Of Merger By Absorption Of Mahindra Heavy Engines Limited And Mahindra Two Wheelers Limited And Trringo.Com Limited With The Company And Their Respective Shareholders - text: Unaudited Financial Results (Standalone And Consolidated) For The Third Quarter And Nine Months Ended 31St December 2022. - text: Announcement under Regulation 30 (LODR)-Updates on Acquisition - text: Results For The Quarter And Year Ended March 31, 2023 - text: Board Meeting Outcome for Unaudited Standalone & Consolidated Financial Results And Limited Review Reports Of The Statutory Auditors For The First Quarter Ended June 30, 2023 pipeline_tag: text-classification inference: true base_model: sentence-transformers/all-mpnet-base-v2 model-index: - name: SetFit with sentence-transformers/all-mpnet-base-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.926605504587156 name: Accuracy --- # SetFit with sentence-transformers/all-mpnet-base-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-mpnet-base-v2](https://huggingface.co./sentence-transformers/all-mpnet-base-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/all-mpnet-base-v2](https://huggingface.co./sentence-transformers/all-mpnet-base-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 384 tokens - **Number of Classes:** 9 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 | |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 5 | | | 6 | | | 1 | | | 2 | | | 0 | | | 3 | | | 7 | | | 8 | | | 4 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.9266 | ## 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("setfit_model_id") # Run inference preds = model("Results For The Quarter And Year Ended March 31, 2023") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 1 | 14.7204 | 70 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 143 | | 1 | 138 | | 2 | 299 | | 3 | 62 | | 4 | 42 | | 5 | 60 | | 6 | 192 | | 7 | 7 | | 8 | 37 | ### Training Hyperparameters - batch_size: (64, 64) - num_epochs: (2, 2) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 30 - body_learning_rate: (2e-05, 2e-05) - head_learning_rate: 2e-05 - 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.0011 | 1 | 0.1926 | - | | 0.0544 | 50 | 0.1512 | - | | 0.1088 | 100 | 0.07 | - | | 0.1632 | 150 | 0.0327 | - | | 0.2176 | 200 | 0.0192 | - | | 0.2720 | 250 | 0.0109 | - | | 0.3264 | 300 | 0.0129 | - | | 0.3808 | 350 | 0.0124 | - | | 0.4353 | 400 | 0.0056 | - | | 0.4897 | 450 | 0.021 | - | | 0.5441 | 500 | 0.0392 | - | | 0.5985 | 550 | 0.0127 | - | | 0.6529 | 600 | 0.0211 | - | | 0.7073 | 650 | 0.0031 | - | | 0.7617 | 700 | 0.0054 | - | | 0.8161 | 750 | 0.0046 | - | | 0.8705 | 800 | 0.027 | - | | 0.9249 | 850 | 0.0229 | - | | 0.9793 | 900 | 0.0065 | - | | 1.0337 | 950 | 0.0058 | - | | 1.0881 | 1000 | 0.0134 | - | | 1.1425 | 1050 | 0.0319 | - | | 1.1970 | 1100 | 0.0042 | - | | 1.2514 | 1150 | 0.0065 | - | | 1.3058 | 1200 | 0.0016 | - | | 1.3602 | 1250 | 0.0094 | - | | 1.4146 | 1300 | 0.0173 | - | | 1.4690 | 1350 | 0.0042 | - | | 1.5234 | 1400 | 0.0083 | - | | 1.5778 | 1450 | 0.0011 | - | | 1.6322 | 1500 | 0.0092 | - | | 1.6866 | 1550 | 0.0184 | - | | 1.7410 | 1600 | 0.0073 | - | | 1.7954 | 1650 | 0.0188 | - | | 1.8498 | 1700 | 0.0211 | - | | 1.9042 | 1750 | 0.0016 | - | | 1.9587 | 1800 | 0.0118 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.1 - Sentence Transformers: 2.2.2 - Transformers: 4.35.2 - PyTorch: 2.1.0+cu121 - Datasets: 2.15.0 - Tokenizers: 0.15.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} } ```