--- base_model: sentence-transformers/all-mpnet-base-v2 library_name: setfit metrics: - accuracy pipeline_tag: text-classification tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: 'As soon as I saw my human pull out my favorite red leash, my tail started wagging and I started barking enthusiastically. I had been waiting all day to go to my favorite place in the whole world, outside. When my human clipped my leash to my collar, I felt my heart sing with joy. Finally! As soon as I stepped out the door, I felt the cool autumn breeze wash over me like a wave. The squirrels scattered inside of the trees and the birds whistled in harmonies that floated through the autumn breeze. The trees were a deep, rich emerald color that drifted me off into a new universe. That is what I loved about the outside, it was always so peaceful and serene. We walked a few blocks admiring nature''s beauty until we suddenly halted to a stop. I looked around but found nothing that looked out of the ordinary. My human opened the car door and placed me in the back seat. My heart started to beat so fast I thought it would burst out of my chest and my mind was racing. Where are we going? Millions of dreadful thoughts popped into my brain. By the time we arrived, my fur was soaked with sweat. As soon as I walked out the door, I stopped in my tracks. In front of me was a place I can only describe as paradise. Behind the white gate, there were clusters of dogs and rubber balls crowding the green grass. What more could a dog ever dream of? My heart sang with joy as I stepped through the gate. I knew then that this would be the best day of my life. ' - text: 'Rock bottom interest rates and easy money, maybe. But many of these truly tech companies like Microsoft, Apple, Facebook and so on have huge cash reserves. I live in Gatesville, Seattle, and I will offer another explanation or at least a contributing factor. A senior software engineer at Microsoft makes anywhere from a new hire at $250K per year with gold plated benefits up to $500K per year for someone with a few years under their belt. Microsoft hires numerous "independent contractors" at half or less than what they pay full time employees also with substantially lesser benefits who work from home. Look for them to increase their base of independent contractors as long as the government lets them get away with it. ' - text: '“Amid this dynamic environment, we delivered record results in fiscal year 2022: We reported $198 billion in revenue and $83 billion in operating income. And the Microsoft Cloud surpassed $100 billion in annualized revenue for the first time.”- From Microsoft’s 2022 Annual Report Shareholder’s Letter ' - text: 'Paresh Y Murudkar Hypothesis: Google wants it leaked. OpenAI has by being public acquired huge amount of attention. Although Google will likely achieve partity with OpenAI shortly, their immediate danger is to become the default definition of the technology. Microsoft found out years ago that even though Bing had reached technical parity with Google, the public had been convinced to search for something was to "Google It.''Thus, Google has to ghet out there with its own stuff, before the "GPT It" because the next generation term for search. ' - text: 'Mor -- You sound like someone who has never experienced real hardship. Your idea that homelessness is a "lifestyle", as if it were freely chosen, suggests you have never been there. Try to imagine this: Your employer has a big layoff, and with two week''s severance, you lose your job. For a while, you get by on unemployment and your spouse''s part-time income. But then unemployment runs out because your industry has tanked in your state. You search fruitlessly for a job, and begin to get really depressed. Your spouse is diagnosed with cancer, and to pay for their treatment, you sell your modest home and move in with your brother-in-law and his family, living in their basement, sharing their one bathroom. Your teenage child who has been uprooted to a new town and school starts taking drugs and acting out, getting arrested, coming home really late, making a lot of noise, being very depressed and angry at everyone. The brother-in-law says his sister with cancer can stay but your teen cannot. You two move into another relative''s basement, but that doesn''t last long. Your teen disappears, leaves a note "I can''t stand it anymore. Sorry, love you, gotta go." You run out of your last cash sending it to help your wife. The relative can''t afford to feed you. You end up on the street. Open your mind. ' inference: true 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: 1.0 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:** 2 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 | |:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | yes | | | no | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 1.0 | ## 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("davidadamczyk/setfit-model-1") # Run inference preds = model("“Amid this dynamic environment, we delivered record results in fiscal year 2022: We reported $198 billion in revenue and $83 billion in operating income. And the Microsoft Cloud surpassed $100 billion in annualized revenue for the first time.”- From Microsoft’s 2022 Annual Report Shareholder’s Letter ") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 13 | 132.875 | 296 | | Label | Training Sample Count | |:------|:----------------------| | no | 18 | | yes | 22 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 120 - 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 - 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.0017 | 1 | 0.3822 | - | | 0.0833 | 50 | 0.1268 | - | | 0.1667 | 100 | 0.0018 | - | | 0.25 | 150 | 0.0003 | - | | 0.3333 | 200 | 0.0002 | - | | 0.4167 | 250 | 0.0001 | - | | 0.5 | 300 | 0.0001 | - | | 0.5833 | 350 | 0.0001 | - | | 0.6667 | 400 | 0.0001 | - | | 0.75 | 450 | 0.0001 | - | | 0.8333 | 500 | 0.0001 | - | | 0.9167 | 550 | 0.0001 | - | | 1.0 | 600 | 0.0001 | - | ### Framework Versions - Python: 3.10.13 - SetFit: 1.1.0 - Sentence Transformers: 3.0.1 - Transformers: 4.45.2 - PyTorch: 2.4.0+cu124 - Datasets: 2.21.0 - Tokenizers: 0.20.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} } ```