--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer base_model: sentence-transformers/paraphrase-mpnet-base-v2 datasets: - go_emotions metrics: - accuracy widget: - text: Curious as to why he's been passed up so many times now. - text: I think you mean the announcement - text: try to attract the guy that i like. other than that i love gaming drawing writing and watching tv. - text: I thought that phrase was only used for memes now lol at least that's what I got from Vic deals - text: 'Fantastic read, thanks for the insights! ' pipeline_tag: text-classification inference: false --- # SetFit with sentence-transformers/paraphrase-mpnet-base-v2 This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [go_emotions](https://huggingface.co/datasets/go_emotions) dataset that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2) as the Sentence Transformer embedding model. A OneVsRestClassifier 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-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2) - **Classification head:** a OneVsRestClassifier instance - **Maximum Sequence Length:** 512 tokens - **Training Dataset:** [go_emotions](https://huggingface.co/datasets/go_emotions) ### 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) ## 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("bhaskars113/go-emotions-multilabel") # Run inference preds = model("I think you mean the announcement") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 1 | 13.6060 | 30 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 20 - 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.0004 | 1 | 0.3873 | - | | 0.0223 | 50 | 0.2243 | - | | 0.0446 | 100 | 0.2305 | - | | 0.0670 | 150 | 0.2297 | - | | 0.0893 | 200 | 0.2758 | - | | 0.1116 | 250 | 0.2197 | - | | 0.1339 | 300 | 0.1984 | - | | 0.1562 | 350 | 0.1729 | - | | 0.1786 | 400 | 0.1244 | - | | 0.2009 | 450 | 0.164 | - | | 0.2232 | 500 | 0.1587 | - | | 0.2455 | 550 | 0.2272 | - | | 0.2679 | 600 | 0.3367 | - | | 0.2902 | 650 | 0.1715 | - | | 0.3125 | 700 | 0.2213 | - | | 0.3348 | 750 | 0.2394 | - | | 0.3571 | 800 | 0.1275 | - | | 0.3795 | 850 | 0.1919 | - | | 0.4018 | 900 | 0.143 | - | | 0.4241 | 950 | 0.2431 | - | | 0.4464 | 1000 | 0.1747 | - | | 0.4688 | 1050 | 0.1567 | - | | 0.4911 | 1100 | 0.194 | - | | 0.5134 | 1150 | 0.1895 | - | | 0.5357 | 1200 | 0.1601 | - | | 0.5580 | 1250 | 0.1042 | - | | 0.5804 | 1300 | 0.0553 | - | | 0.6027 | 1350 | 0.1614 | - | | 0.625 | 1400 | 0.1854 | - | | 0.6473 | 1450 | 0.1259 | - | | 0.6696 | 1500 | 0.138 | - | | 0.6920 | 1550 | 0.2181 | - | | 0.7143 | 1600 | 0.1144 | - | | 0.7366 | 1650 | 0.1987 | - | | 0.7589 | 1700 | 0.0859 | - | | 0.7812 | 1750 | 0.1665 | - | | 0.8036 | 1800 | 0.1628 | - | | 0.8259 | 1850 | 0.2296 | - | | 0.8482 | 1900 | 0.1892 | - | | 0.8705 | 1950 | 0.2033 | - | | 0.8929 | 2000 | 0.1507 | - | | 0.9152 | 2050 | 0.1592 | - | | 0.9375 | 2100 | 0.1077 | - | | 0.9598 | 2150 | 0.1415 | - | | 0.9821 | 2200 | 0.1561 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.7.0 - Transformers: 4.40.0 - PyTorch: 2.2.1+cu121 - Datasets: 2.19.0 - Tokenizers: 0.19.1 ## 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} } ```