--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: سیب زمینی خوب بود ولی ساندویچ اصلا جالب نبود کاملا سفت بود - text: شبیه شوخی بود بیشتر ، نوشتم ساندویچ بدون قارچ و خودشوم تو فاکترش نوشته ، اما توش یه دنیا قارچ داشت خیلی هم سرد بود + خیلی هم دیر آورد - text: همه چیز خوب و خوشمزه بود، جز نان سنگک، مثل نان باگت میتوانستی بینش را باز کنی و مواد بزاری، اون کله پاچه خوشمزه و این نون بسیار بد به هم نمیان - text: خوبه ولی کیفیت ظروف مناسب نیست - text: متاسفانه سفارش بنده را اشتباه آورده بودند.و با یک سفارش دیگر که از شرکت به صورت تلفنی سفارش گذاشته بودند، اشتباه گرفته بودند. pipeline_tag: text-classification inference: true base_model: m3hrdadfi/albert-zwnj-wnli-mean-tokens model-index: - name: SetFit with m3hrdadfi/albert-zwnj-wnli-mean-tokens results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.045454545454545456 name: Accuracy --- # SetFit with m3hrdadfi/albert-zwnj-wnli-mean-tokens This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [m3hrdadfi/albert-zwnj-wnli-mean-tokens](https://huggingface.co/m3hrdadfi/albert-zwnj-wnli-mean-tokens) 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:** [m3hrdadfi/albert-zwnj-wnli-mean-tokens](https://huggingface.co/m3hrdadfi/albert-zwnj-wnli-mean-tokens) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 128 tokens - **Number of Classes:** 11 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 | |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 7 | | | 4 | | | 3 | | | 5 | | | 0 | | | 8 | | | 6 | | | 2 | | | 9 | | | 1 | | | 10 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.0455 | ## 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("keivan/albert-zwnj-wnli-mean-tokens") # Run inference preds = model("خوبه ولی کیفیت ظروف مناسب نیست") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 3 | 21.3377 | 72 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 7 | | 1 | 7 | | 2 | 7 | | 3 | 7 | | 4 | 7 | | 5 | 7 | | 6 | 7 | | 7 | 7 | | 8 | 7 | | 9 | 7 | | 10 | 7 | ### Training Hyperparameters - batch_size: (8, 8) - num_epochs: (2, 2) - max_steps: -1 - sampling_strategy: oversampling - body_learning_rate: (2e-05, 1e-05) - head_learning_rate: 0.01 - 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: True ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:-------:|:--------:|:-------------:|:---------------:| | 0.0015 | 1 | 0.3989 | - | | 0.0742 | 50 | 0.2221 | - | | 0.1484 | 100 | 0.2617 | - | | 0.2226 | 150 | 0.0514 | - | | 0.2967 | 200 | 0.0852 | - | | 0.3709 | 250 | 0.0754 | - | | 0.4451 | 300 | 0.0353 | - | | 0.5193 | 350 | 0.0091 | - | | 0.5935 | 400 | 0.0116 | - | | 0.6677 | 450 | 0.0213 | - | | 0.7418 | 500 | 0.0036 | - | | 0.8160 | 550 | 0.0039 | - | | 0.8902 | 600 | 0.011 | - | | 0.9644 | 650 | 0.0014 | - | | 1.0 | 674 | - | 0.0344 | | 1.0386 | 700 | 0.0014 | - | | 1.1128 | 750 | 0.0028 | - | | 1.1869 | 800 | 0.0003 | - | | 1.2611 | 850 | 0.0003 | - | | 1.3353 | 900 | 0.0002 | - | | 1.4095 | 950 | 0.0006 | - | | 1.4837 | 1000 | 0.0005 | - | | 1.5579 | 1050 | 0.0002 | - | | 1.6320 | 1100 | 0.0002 | - | | 1.7062 | 1150 | 0.0003 | - | | 1.7804 | 1200 | 0.0002 | - | | 1.8546 | 1250 | 0.0001 | - | | 1.9288 | 1300 | 0.0002 | - | | **2.0** | **1348** | **-** | **0.0319** | * The bold row denotes the saved checkpoint. ### 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.15.0 - 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} } ```