--- 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: 'Alexis it Doesn’t Have To End Georgiawas invaded by Russia and lost its territoryof Ossetia and Abkhazia. What did USAdo? It condemned the invasion by issuinga statement. George Bush and Putin, bothguests at Beijing Olympic opening ceremony,argued. Georgia appreciates. ' - text: 'DLI believe she also married Aristotle Onassis, who owned the world''s largest private shipping fleet -- that may have helped finance her other life choices... ' - text: 'Remember watching this movie with my wife as newly weds in 1995. Wonderful evergreen film. Shahrukh was the son every father wants. And every girl wants as a boyfriend or husband. True love. The relationship between Anupam Kher and his son Shahrukh is pleasant and different than usual Punjabi father-son distant relationships. Music is beautiful! My children love this movie as well. I could watch it anytime-does not seem old or dated. Thank you Yash Chopra, Aditya Chopra, Shahrukh, Kajol and all of the team who brought us this beautiful human drama! ' - text: 'In the photo of the D''Alesandro family with Pres. Kennedy, I think it is telling that Mrs. D''Alesandro is doing the "adoring" look at Mr. D''Alesandro. Par for the course for a 1961 pol''s wife.Meanwhile their 21-year-old daughter Nancy already has her piercing eyes unabashedly fixed right on Kennedy. You can almost see her thinking, "This powerful man can do great things for the country. How do I get there?"And she did get there -- to within a couple heartbeats of the Presidency, and arguably a position far more powerful and effective over her career than if she''d taken a term in the White House. ' - text: 'Why is it that grown men feel free to do these sorts of things to young girls and that societies tolerate it? Why is the girl the one who is put on trial instead of the man/men who are responsible for what they did to her? Why is her life ruined? Why are women forced to prove their virtue over and over after they''ve been sexually assaulted by a husband, a relative, a male friend, or a stranger? The worst of all is that the girls, who are too young to marry, can still become pregnant and be forced to carry the pregnancy to term. What does it do to both the children when one is the result of rape? How does one deal with a child who exists through no fault of its own? We know this happens all over the world. It happens here too. Even if we''re a rich country and have "enlightened" attitudes, when we deny women of any age the right to control their reproductive lives, we are showing exactly how little we think of women. On a personal note, my parents didn''t want to have me when they did. When I was 16 my mother told me, in a fit of anger, that if it weren''t for the abortion laws (in the 1950s) I wouldn''t be here. But I was not a child of rape. I can''t imagine how that feels for the victim or the child (who is also a victim). Is the answer education for both boys and girls? Or is it forcing a real change in the attitudes societies have towards half of their population, the half that does much of the caring, loving, and raising of children? ' 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: 0.9 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** | 0.9 | ## 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-9") # Run inference preds = model("DLI believe she also married Aristotle Onassis, who owned the world's largest private shipping fleet -- that may have helped finance her other life choices... ") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 37 | 170.9 | 276 | | 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.5127 | - | | 0.0833 | 50 | 0.2133 | - | | 0.1667 | 100 | 0.0057 | - | | 0.25 | 150 | 0.0002 | - | | 0.3333 | 200 | 0.0001 | - | | 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.0 | - | | 1.0 | 600 | 0.0 | - | ### 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} } ```