--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: '6) , it is interesting to note how, going from lateral to downstream positions, from 1 to 13: -charged hadrons (protons, pions, kaons) contribution rises from 34% to 48%; -electrons and positrons contribution rises from 30% to 40%; -muons doses are stable around the 3-4%, representing an almost negligible portion of the total; -photons doses decrease from 24% to 7% in terms of contribution to the total; -neutrons contribution goes down from 8.5% to 2.5% in terms of contribution to the total.' - text: the study was conducted in 2015 on adolescent undergraduate university students of three fields of study -humanities, as well as medical and technical courses. - text: For this purpose, it was first necessary to discover the interdependencies of the data attributes. - text: The patients included in this study were recruited from the Vascular Department of West China Hospital, Sichuan University, between January 2009 and January 2011. - text: 1 Likewise, age at diagnosis (P Ͻ 0.001), primary site (P ϭ 0.04), number of positive nodes (P Ͻ 0.001), and depth of invasion (P Ͻ 0.001) had a significant impact on diseasespecific survival of the MRI patients. pipeline_tag: text-classification inference: true base_model: sentence-transformers/all-MiniLM-L6-v2 model-index: - name: SetFit with sentence-transformers/all-MiniLM-L6-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.9433333333333334 name: Accuracy --- # SetFit with sentence-transformers/all-MiniLM-L6-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-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-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-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 256 tokens - **Number of Classes:** 9 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 | |:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.9433 | ## 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("Corran/Jina_Sci2") # Run inference preds = model("For this purpose, it was first necessary to discover the interdependencies of the data attributes.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 5 | 26.2526 | 128 | | Label | Training Sample Count | |:------|:----------------------| | 1 | 300 | | 2 | 300 | | 3 | 300 | | 4 | 300 | | 5 | 300 | | 6 | 300 | | 7 | 300 | | 8 | 300 | | 9 | 300 | ### Training Hyperparameters - batch_size: (75, 75) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 10 - 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.0014 | 1 | 0.4034 | - | | 0.0694 | 50 | 0.2314 | - | | 0.1389 | 100 | 0.1816 | - | | 0.2083 | 150 | 0.1708 | - | | 0.2778 | 200 | 0.1079 | - | | 0.3472 | 250 | 0.1407 | - | | 0.4167 | 300 | 0.0788 | - | | 0.4861 | 350 | 0.0565 | - | | 0.5556 | 400 | 0.0651 | - | | 0.625 | 450 | 0.0402 | - | | 0.6944 | 500 | 0.0468 | - | | 0.7639 | 550 | 0.055 | - | | 0.8333 | 600 | 0.0473 | - | | 0.9028 | 650 | 0.0605 | - | | 0.9722 | 700 | 0.03 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.1 - Sentence Transformers: 2.2.2 - Transformers: 4.35.2 - PyTorch: 2.1.0+cu121 - Datasets: 2.16.1 - 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} } ```