--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: is completely right on this. carnildo’s comment is just a waste of space. 176.12.107.140 - text: '" please do not vandalize pages, as you did with this edit to bella swan. if you continue to do so, you will be blocked from editing. (talk) "' - text: ipv6 mirc doesn't natively supports ipv6 protocols. it could be enabled by adding a external dll plugin who will enable a special protocol for dns and connecting to ipv6 servers. - text: '" link thanks for fixing that disambiguation link on usher''s album ) flash; "' - text: '|b-class-1= yes |b-class-2= yes |b-class-3= yes |b-class-4= yes |b-class-5= yes' pipeline_tag: text-classification inference: false base_model: sentence-transformers/paraphrase-mpnet-base-v2 model-index: - name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.8041298489691044 name: Accuracy --- # SetFit with sentence-transformers/paraphrase-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/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 ### 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) ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8041 | ## 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("waterabbit114/my-setfit-classifier") # Run inference preds = model("\" link thanks for fixing that disambiguation link on usher's album ) flash; \"") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 3 | 69.1481 | 898 | ### Training Hyperparameters - batch_size: (1, 1) - 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.0005 | 1 | 0.2094 | - | | 0.0231 | 50 | 0.033 | - | | 0.0463 | 100 | 0.0439 | - | | 0.0694 | 150 | 0.001 | - | | 0.0926 | 200 | 0.0245 | - | | 0.1157 | 250 | 0.0008 | - | | 0.1389 | 300 | 0.0001 | - | | 0.1620 | 350 | 0.0 | - | | 0.1852 | 400 | 0.0012 | - | | 0.2083 | 450 | 0.0 | - | | 0.2315 | 500 | 0.0002 | - | | 0.2546 | 550 | 0.0006 | - | | 0.2778 | 600 | 0.002 | - | | 0.3009 | 650 | 0.0044 | - | | 0.3241 | 700 | 0.0015 | - | | 0.3472 | 750 | 0.0007 | - | | 0.3704 | 800 | 0.0001 | - | | 0.3935 | 850 | 0.0001 | - | | 0.4167 | 900 | 0.0001 | - | | 0.4398 | 950 | 0.0004 | - | | 0.4630 | 1000 | 0.0001 | - | | 0.4861 | 1050 | 0.0001 | - | | 0.5093 | 1100 | 0.0 | - | | 0.5324 | 1150 | 0.0052 | - | | 0.5556 | 1200 | 0.0002 | - | | 0.5787 | 1250 | 0.0 | - | | 0.6019 | 1300 | 0.0003 | - | | 0.625 | 1350 | 0.0 | - | | 0.6481 | 1400 | 0.0001 | - | | 0.6713 | 1450 | 0.0 | - | | 0.6944 | 1500 | 0.0 | - | | 0.7176 | 1550 | 0.0 | - | | 0.7407 | 1600 | 0.0002 | - | | 0.7639 | 1650 | 0.0001 | - | | 0.7870 | 1700 | 0.0011 | - | | 0.8102 | 1750 | 0.0001 | - | | 0.8333 | 1800 | 0.0 | - | | 0.8565 | 1850 | 0.0001 | - | | 0.8796 | 1900 | 0.0006 | - | | 0.9028 | 1950 | 0.0002 | - | | 0.9259 | 2000 | 0.0002 | - | | 0.9491 | 2050 | 0.0 | - | | 0.9722 | 2100 | 0.0001 | - | | 0.9954 | 2150 | 0.0 | - | ### Framework Versions - Python: 3.11.7 - SetFit: 1.0.3 - Sentence Transformers: 2.2.2 - Transformers: 4.35.2 - PyTorch: 2.1.1+cu121 - Datasets: 2.14.5 - Tokenizers: 0.15.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} } ```