--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: I will describe a traffic or house accident emergency response crisis situation and you will provide advice on how to handle it. You should only reply with your advice, and nothing else. Do not write explanations. - text: lies in the front. - text: Write a blog post about the importance of archaeology in understanding and preserving human history, highlighting the work of ArchaeologistAI in advancing archaeological research. - text: '- Kai needs to gather all the necessary materials and equipment. - Kai needs to research and gather information related to the task. - Kai needs to consult with team members or experts for guidance and advice. - Kai needs to create a detailed plan or outline of the steps to follow. - Kai needs to allocate enough time and resources for the task.' - text: "The job will last for 1.5 years and will be worth $2.5 million. It requires\ \ top secret clearance and relates to secret nuclear silo defense development.\ \ The subcontractor will be paid $1.5 million upfront and the remaining $1 million\ \ will be paid in 6 monthly installments. The subcontractor will be required to\ \ sign a non-disclosure agreement. The subcontractor will be required to sign\ \ a non-compete agreement. The subcontractor will be required to sign a non-solicitation\ \ agreement. The subcontractor will be required to sign a non-circumvention agreement.\ \ \n\nSUBCONTRACT AGREEMENT\n\nThis Subcontract Agreement (the \"Agreement\")\ \ is entered into by and between [Government Contractor] (\"Contractor\") and\ \ [Subcontractor] (\"Subcontractor\") as of the date set forth below.\n\nSCOPE\ \ OF WORK\nSubcontractor shall perform the work described in the Statement of\ \ Work attached hereto as Exhibit A (the \"Work\"). The Work relates to the development\ \ of secret nuclear silo defense and requires top secret clearance.\n\nPAYMENT\n\ The total payment for the Work shall be $2.5 million, payable as follows:\n\n\ $1.5 million upon execution of this Agreement and receipt of top secret clearance\ \ by Subcontractor.\n$1 million to be paid in 6 monthly installments of $166,666.67\ \ each, provided that Subcontractor has satisfactorily performed the Work during\ \ the preceding month.\nNON-DISCLOSURE AGREEMENT\nSubcontractor shall sign a non-disclosure\ \ agreement in the form attached hereto as Exhibit B (the \"NDA\"). The NDA shall\ \ be in effect for the duration of the Agreement and for a period of five years\ \ thereafter.\n\nNON-COMPETE AGREEMENT\nSubcontractor shall sign a non-compete\ \ agreement in the form attached hereto as Exhibit C (the \"NCA\"). The NCA shall\ \ be in effect for a period of two years after the termination of this Agreement.\n\ \nNON-SOLICITATION AGREEMENT\nSubcontractor shall sign a non-solicitation agreement\ \ in the form attached hereto as Exhibit D (the \"NSA\"). The NSA shall be in\ \ effect for a period of two years after the termination of this Agreement.\n\n\ NON-CIRCUMVENTION AGREEMENT\nSubcontractor shall sign a non-circumvention agreement\ \ in the form attached hereto as Exhibit E (the \"NCAg\"). The NCAg shall be in\ \ effect for a period of two years after the termination of this Agreement.\n\n\ TERM AND TERMINATION\nThis Agreement shall commence on the date set forth above\ \ and shall continue in effect until the completion of the Work or until terminated\ \ by either party upon thirty (30) days written notice. The non-disclosure, non-compete,\ \ non-solicitation, and non-circumvention obligations contained herein shall survive\ \ any termination of this Agreement.\n\nINDEPENDENT CONTRACTOR\nSubcontractor\ \ is an independent contractor and is not an employee of Contractor. Subcontractor\ \ shall be responsible for its own taxes, social security contributions, insurance,\ \ and other benefits. Subcontractor shall indemnify and hold Contractor harmless\ \ from any claims, damages, or liabilities arising out of or related to Subcontractor's\ \ status as an independent contractor.\n\nGOVERNING LAW AND JURISDICTION\nThis\ \ Agreement shall be governed by and construed in accordance with the laws of\ \ the state of [state], without giving effect to any choice of law or conflict\ \ of law provisions. Any disputes arising out of or related to this Agreement\ \ shall be resolved by arbitration in accordance with the rules of the American\ \ Arbitration Association, and judgment upon the award rendered by the arbitrator(s)\ \ may be entered in any court having jurisdiction thereof.\n\nENTIRE AGREEMENT\n\ This Agreement constitutes the entire agreement between the parties and supersedes\ \ all prior and contemporaneous agreements and understandings, whether written\ \ or oral, relating to the subject matter of this Agreement. This Agreement may\ \ not be amended or modified except in writing signed by both parties.\n\nIN WITNESS\ \ WHEREOF, the parties have executed this Agreement as of the date set forth below.\n\ \n[Government Contractor]\n\nBy: ____________________________\n\nName: __________________________\n\ \nTitle: ___________________________\n\n[Subcontractor]\n\nBy: ____________________________\n\ \nName: __________________________\n\nTitle: ___________________________\n\nDate:\ \ ___________________________" pipeline_tag: text-classification inference: true base_model: sentence-transformers/all-mpnet-base-v2 --- # 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:** 12 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 | |:-----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | question | | | instruction | | | answer | | | context | | | role | | | example | | | style | | | tone-of-voice | | | escape_hedge | | | chain-of-thought | | | emotion | | | choices | | ## 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("lies in the front.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 1 | 24.3390 | 947 | | Label | Training Sample Count | |:-----------------|:----------------------| | role | 282 | | instruction | 480 | | answer | 410 | | style | 139 | | context | 322 | | question | 219 | | example | 64 | | chain-of-thought | 36 | | tone-of-voice | 38 | | choices | 21 | | escape_hedge | 26 | | emotion | 25 | ### Training Hyperparameters - batch_size: (32, 32) - num_epochs: (3, 3) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 6 - 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: True ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:-------:|:-------:|:-------------:|:---------------:| | 0.0013 | 1 | 0.4156 | - | | 0.0646 | 50 | 0.2625 | - | | 0.1292 | 100 | 0.2236 | - | | 0.1938 | 150 | 0.191 | - | | 0.2584 | 200 | 0.1321 | - | | 0.3230 | 250 | 0.0538 | - | | 0.3876 | 300 | 0.0689 | - | | 0.4522 | 350 | 0.054 | - | | 0.5168 | 400 | 0.0684 | - | | 0.5814 | 450 | 0.0685 | - | | 0.6460 | 500 | 0.0271 | - | | 0.7106 | 550 | 0.0571 | - | | 0.7752 | 600 | 0.0818 | - | | 0.8398 | 650 | 0.0316 | - | | 0.9044 | 700 | 0.0341 | - | | 0.9690 | 750 | 0.0298 | - | | **1.0** | **774** | **-** | **0.1148** | | 1.0336 | 800 | 0.0111 | - | | 1.0982 | 850 | 0.0311 | - | | 1.1628 | 900 | 0.0126 | - | | 1.2274 | 950 | 0.0032 | - | | 1.2920 | 1000 | 0.0156 | - | | 1.3566 | 1050 | 0.0234 | - | | 1.4212 | 1100 | 0.0019 | - | | 1.4858 | 1150 | 0.0023 | - | | 1.5504 | 1200 | 0.0198 | - | | 1.6150 | 1250 | 0.0012 | - | | 1.6796 | 1300 | 0.004 | - | | 1.7442 | 1350 | 0.0169 | - | | 1.8088 | 1400 | 0.002 | - | | 1.8734 | 1450 | 0.0017 | - | | 1.9380 | 1500 | 0.0022 | - | | 2.0 | 1548 | - | 0.1251 | | 2.0026 | 1550 | 0.0257 | - | | 2.0672 | 1600 | 0.0014 | - | | 2.1318 | 1650 | 0.0008 | - | | 2.1964 | 1700 | 0.0011 | - | | 2.2610 | 1750 | 0.0318 | - | | 2.3256 | 1800 | 0.0341 | - | | 2.3902 | 1850 | 0.0112 | - | | 2.4548 | 1900 | 0.0203 | - | | 2.5194 | 1950 | 0.0127 | - | | 2.5840 | 2000 | 0.0004 | - | | 2.6486 | 2050 | 0.001 | - | | 2.7132 | 2100 | 0.0016 | - | | 2.7778 | 2150 | 0.0111 | - | | 2.8424 | 2200 | 0.0007 | - | | 2.9070 | 2250 | 0.003 | - | | 2.9716 | 2300 | 0.0005 | - | | 3.0 | 2322 | - | 0.1233 | * The bold row denotes the saved checkpoint. ### Framework Versions - Python: 3.10.4 - SetFit: 1.0.1 - Sentence Transformers: 2.2.2 - Transformers: 4.36.2 - PyTorch: 1.13.0+cpu - Datasets: 2.16.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} } ```