--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer base_model: avsolatorio/GIST-small-Embedding-v0 metrics: - accuracy widget: - text: 'User: Hello, I want to transfer some funds to another bank account. Bank Bot: Hi, you can do that through our online banking system. Can you please confirm the amount and the account details? User: Sure, I want to transfer $500 to account number 123456789. Bank Bot: Okay, I have processed your request to transfer $500 to account number 123456789. Is there anything else I can assist you with? User: No, actually I wanted to transfer $1000, not $500.' - text: 'User: Hello, I''m having trouble with my ATM card. Bank Bot: I''m sorry to hear that. To assist you further, could you please provide me with your account number. User: Yeah, 1234454673838 this is my account number. Bank Bot: It seems like your account is blocked. We will investigate and get back to you. Do you have any other issues? User: That''s all I needed help with. Thank you for your assistance.' - text: 'User: Hello, how do I transfer funds to my friend''s account? Bank Bot: Hi, you can transfer funds through our online banking system or mobile banking app. Which one would you prefer? User: I would prefer the mobile banking app. Bank Bot: Great! To transfer funds through the app, you need to login first. Once logged in, select the option "Transfer Funds" from the menu. User: Okay, I have logged in and selected "Transfer Funds". What details do I need to provide? Bank Bot: You need to provide the account number, name of the recipient, and the bank name and branch where your friend''s account is held. Do you have these details handy? User: Yes, I do. But can you confirm the daily transfer limit for me?' - text: 'User: Hello, I''m having trouble with my ATM card. Bank Bot: I''m sorry to hear that. To assist you further, could you please provide me with your account number. User: Yes, my account number is 9872123424. Bank Bot: When did you transferred your money? User: The transaction happened on 5th September. Bank Bot: Okay, I''ll investigate. User: Sorry, I provided the wrong date for the transaction. It was actually on 6th September.' - text: 'User: Hello, how do I transfer funds to my friend''s account? Bank Bot: Hi, you can transfer funds through our online banking system or mobile banking app. Which one would you prefer? User: I would prefer the online banking. Bank Bot: Alright. Can you please provide me the account number of your friend to initiate the transfer? User: I''m sorry, I cannot provide you with that information. Bank Bot: I understand. However, we need the account number to initiate the transfer. Alternatively, you can ask your friend to provide their account number to you and then initiate the transfer. User: I still refuse to provide the account number. Is there any other way to transfer funds?' pipeline_tag: text-classification inference: true model-index: - name: SetFit with avsolatorio/GIST-small-Embedding-v0 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.5714285714285714 name: Accuracy --- # SetFit with avsolatorio/GIST-small-Embedding-v0 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [avsolatorio/GIST-small-Embedding-v0](https://huggingface.co/avsolatorio/GIST-small-Embedding-v0) 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:** [avsolatorio/GIST-small-Embedding-v0](https://huggingface.co/avsolatorio/GIST-small-Embedding-v0) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 512 tokens - **Number of Classes:** 14 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 | |:---------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Restart Conversation | | | Correction Request | | | Affirmative Confirmation | | | Questions Requiring External Information | | | Repeat Conversation | | | Pause Conversation | | | Negative Confirmation | | | Continue Conversation | | | End Conversation | | | New Inquiry or Request | | | Questions Answerable by Conversational Context / History | | | Refuse to Answer | | | Transfer to Human Agent | | | Questions on Process | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.5714 | ## 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("setfit_model_id") # Run inference preds = model("User: Hello, I'm having trouble with my ATM card. Bank Bot: I'm sorry to hear that. To assist you further, could you please provide me with your account number. User: Yeah, 1234454673838 this is my account number. Bank Bot: It seems like your account is blocked. We will investigate and get back to you. Do you have any other issues? User: That's all I needed help with. Thank you for your assistance.") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:---------|:----| | Word count | 34 | 109.9786 | 227 | | Label | Training Sample Count | |:---------------------------------------------------------|:----------------------| | Continue Conversation | 10 | | Pause Conversation | 10 | | Restart Conversation | 10 | | Repeat Conversation | 10 | | End Conversation | 10 | | Refuse to Answer | 10 | | Affirmative Confirmation | 10 | | Negative Confirmation | 10 | | Correction Request | 10 | | Questions Answerable by Conversational Context / History | 10 | | Questions Requiring External Information | 10 | | Questions on Process | 10 | | New Inquiry or Request | 10 | | Transfer to Human Agent | 10 | ### Training Hyperparameters - batch_size: (12, 12) - num_epochs: (3, 3) - 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: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0007 | 1 | 0.3613 | - | | 0.0330 | 50 | 0.3367 | - | | 0.0659 | 100 | 0.2621 | - | | 0.0989 | 150 | 0.1997 | - | | 0.1318 | 200 | 0.1906 | - | | 0.1648 | 250 | 0.1034 | - | | 0.1978 | 300 | 0.0784 | - | | 0.2307 | 350 | 0.1119 | - | | 0.2637 | 400 | 0.0694 | - | | 0.2966 | 450 | 0.0693 | - | | 0.3296 | 500 | 0.0542 | - | | 0.3626 | 550 | 0.0669 | - | | 0.3955 | 600 | 0.0594 | - | | 0.4285 | 650 | 0.0175 | - | | 0.4614 | 700 | 0.0125 | - | | 0.4944 | 750 | 0.0057 | - | | 0.5274 | 800 | 0.0086 | - | | 0.5603 | 850 | 0.076 | - | | 0.5933 | 900 | 0.0077 | - | | 0.6262 | 950 | 0.0135 | - | | 0.6592 | 1000 | 0.012 | - | | 0.6922 | 1050 | 0.0094 | - | | 0.7251 | 1100 | 0.0735 | - | | 0.7581 | 1150 | 0.0047 | - | | 0.7910 | 1200 | 0.0699 | - | | 0.8240 | 1250 | 0.0063 | - | | 0.8570 | 1300 | 0.0044 | - | | 0.8899 | 1350 | 0.0028 | - | | 0.9229 | 1400 | 0.0706 | - | | 0.9558 | 1450 | 0.0047 | - | | 0.9888 | 1500 | 0.0711 | - | | 1.0218 | 1550 | 0.0036 | - | | 1.0547 | 1600 | 0.0024 | - | | 1.0877 | 1650 | 0.1245 | - | | 1.1206 | 1700 | 0.0044 | - | | 1.1536 | 1750 | 0.0566 | - | | 1.1866 | 1800 | 0.0045 | - | | 1.2195 | 1850 | 0.0046 | - | | 1.2525 | 1900 | 0.0033 | - | | 1.2854 | 1950 | 0.0031 | - | | 1.3184 | 2000 | 0.0095 | - | | 1.3514 | 2050 | 0.0034 | - | | 1.3843 | 2100 | 0.0031 | - | | 1.4173 | 2150 | 0.049 | - | | 1.4502 | 2200 | 0.0023 | - | | 1.4832 | 2250 | 0.0034 | - | | 1.5162 | 2300 | 0.0039 | - | | 1.5491 | 2350 | 0.0056 | - | | 1.5821 | 2400 | 0.0027 | - | | 1.6150 | 2450 | 0.0025 | - | | 1.6480 | 2500 | 0.0014 | - | | 1.6809 | 2550 | 0.0029 | - | | 1.7139 | 2600 | 0.0024 | - | | 1.7469 | 2650 | 0.0017 | - | | 1.7798 | 2700 | 0.0018 | - | | 1.8128 | 2750 | 0.0018 | - | | 1.8457 | 2800 | 0.0018 | - | | 1.8787 | 2850 | 0.0025 | - | | 1.9117 | 2900 | 0.0024 | - | | 1.9446 | 2950 | 0.0022 | - | | 1.9776 | 3000 | 0.002 | - | | 2.0105 | 3050 | 0.0017 | - | | 2.0435 | 3100 | 0.0021 | - | | 2.0765 | 3150 | 0.0019 | - | | 2.1094 | 3200 | 0.0016 | - | | 2.1424 | 3250 | 0.0017 | - | | 2.1753 | 3300 | 0.0016 | - | | 2.2083 | 3350 | 0.0015 | - | | 2.2413 | 3400 | 0.0017 | - | | 2.2742 | 3450 | 0.0015 | - | | 2.3072 | 3500 | 0.0014 | - | | 2.3401 | 3550 | 0.0012 | - | | 2.3731 | 3600 | 0.0011 | - | | 2.4061 | 3650 | 0.0015 | - | | 2.4390 | 3700 | 0.0016 | - | | 2.4720 | 3750 | 0.0018 | - | | 2.5049 | 3800 | 0.0012 | - | | 2.5379 | 3850 | 0.0021 | - | | 2.5709 | 3900 | 0.0014 | - | | 2.6038 | 3950 | 0.0014 | - | | 2.6368 | 4000 | 0.0013 | - | | 2.6697 | 4050 | 0.0014 | - | | 2.7027 | 4100 | 0.0016 | - | | 2.7357 | 4150 | 0.0016 | - | | 2.7686 | 4200 | 0.0019 | - | | 2.8016 | 4250 | 0.0014 | - | | 2.8345 | 4300 | 0.0015 | - | | 2.8675 | 4350 | 0.0012 | - | | 2.9005 | 4400 | 0.0011 | - | | 2.9334 | 4450 | 0.0013 | - | | 2.9664 | 4500 | 0.0016 | - | | 2.9993 | 4550 | 0.0014 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.7.0 - Transformers: 4.40.1 - 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} } ```