Text Classification
setfit
Safetensors
sentence-transformers
mpnet
generated_from_setfit_trainer
Eval Results (legacy)
text-embeddings-inference
Instructions to use Shankhdhar/classifier_woog_base_oos with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- setfit
How to use Shankhdhar/classifier_woog_base_oos with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("Shankhdhar/classifier_woog_base_oos") preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"]) print(preds) - sentence-transformers
How to use Shankhdhar/classifier_woog_base_oos with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Shankhdhar/classifier_woog_base_oos") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
|
Download README.md from Shankhdhar/classifier_woog_base_oos: direct link, hf CLI and curl.
- Browser
- Download file 13.6 kB
-
https://huggingface.co/Shankhdhar/classifier_woog_base_oos/resolve/main/README.md
- Command line
-
hf download hf://Shankhdhar/classifier_woog_base_oos/README.md
-
curl -L -o README.md https://huggingface.co/Shankhdhar/classifier_woog_base_oos/resolve/main/README.md
13.6 kB
| base_model: sentence-transformers/paraphrase-mpnet-base-v2 | |
| library_name: setfit | |
| metrics: | |
| - accuracy | |
| pipeline_tag: text-classification | |
| tags: | |
| - setfit | |
| - sentence-transformers | |
| - text-classification | |
| - generated_from_setfit_trainer | |
| widget: | |
| - text: What are the different types of zari used in the sarees? | |
| - text: I need to change the delivery address for my recent order, how can I do that? | |
| - text: I need to return an item, what is the return policy for online orders? | |
| - text: Are there any sarees with Fekwa Weave technique? | |
| - text: What are the different colors in the Air Jordan 1 Retro High OG Volt Gold? | |
| inference: true | |
| 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.8666666666666667 | |
| 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 [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/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2) | |
| - **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:** 6 classes | |
| <!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) --> | |
| <!-- - **Language:** Unknown --> | |
| <!-- - **License:** Unknown --> | |
| ### 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 | | |
| |:------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | |
| | Out of Scope | <ul><li>'Why is your website so slow?'</li><li>'Can I get a shoutout on your social media?'</li><li>'I like to listen to classical music'</li></ul> | | |
| | product faq | <ul><li>'What is the price of the Temple Butidaar Multi Color Border Pure Silk Chiffon Georgette Saree?'</li><li>'Do you have the Air Jordan 1 Low Shadow Brown/Brown Kelp- Sail in size 7?'</li><li>'Is the lakadong turmeric powder available for purchase?'</li></ul> | | |
| | order tracking | <ul><li>'What is the expected delivery time for the 10 pack of Cake Boxes to Bhopal?'</li><li>'What is the delivery status for my order placed using email address test@example.com?'</li><li>'I havent received my order'</li></ul> | | |
| | product policy | <ul><li>'What is the policy for returning a product that was part of a Cyber Monday sale?'</li><li>'Are there any exceptions to the return policy for items that were purchased with a special occasion promotion?'</li><li>'Are there any restrictions on returning sneakers with added fur or fur trim?'</li></ul> | | |
| | product discoverability | <ul><li>'Suggest me some high ankle sneakers'</li><li>'Do you have any grocery & gourmet honey available?'</li><li>'Do you have any sneaker collaborations with artists?'</li></ul> | | |
| | general faq | <ul><li>'How many cups of green tea should I drink daily to achieve the recommended therapeutic dosage of ECGC?'</li><li>'what is mashru silk'</li><li>'What specific compounds in Green Tea contribute to its antioxidant properties?'</li></ul> | | |
| ## Evaluation | |
| ### Metrics | |
| | Label | Accuracy | | |
| |:--------|:---------| | |
| | **all** | 0.8667 | | |
| ## 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("Are there any sarees with Fekwa Weave technique?") | |
| ``` | |
| <!-- | |
| ### Downstream Use | |
| *List how someone could finetune this model on their own dataset.* | |
| --> | |
| <!-- | |
| ### Out-of-Scope Use | |
| *List how the model may foreseeably be misused and address what users ought not to do with the model.* | |
| --> | |
| <!-- | |
| ## Bias, Risks and Limitations | |
| *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.* | |
| --> | |
| <!-- | |
| ### Recommendations | |
| *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.* | |
| --> | |
| ## Training Details | |
| ### Training Set Metrics | |
| | Training set | Min | Median | Max | | |
| |:-------------|:----|:--------|:----| | |
| | Word count | 4 | 11.1737 | 28 | | |
| | Label | Training Sample Count | | |
| |:------------------------|:----------------------| | |
| | Out of Scope | 35 | | |
| | general faq | 24 | | |
| | order tracking | 34 | | |
| | product discoverability | 40 | | |
| | product faq | 40 | | |
| | product policy | 40 | | |
| ### Training Hyperparameters | |
| - batch_size: (16, 16) | |
| - 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.0004 | 1 | 0.256 | - | | |
| | 0.0213 | 50 | 0.2639 | - | | |
| | 0.0425 | 100 | 0.2341 | - | | |
| | 0.0638 | 150 | 0.0407 | - | | |
| | 0.0851 | 200 | 0.0698 | - | | |
| | 0.1063 | 250 | 0.014 | - | | |
| | 0.1276 | 300 | 0.0069 | - | | |
| | 0.1489 | 350 | 0.0099 | - | | |
| | 0.1701 | 400 | 0.0014 | - | | |
| | 0.1914 | 450 | 0.0007 | - | | |
| | 0.2127 | 500 | 0.0006 | - | | |
| | 0.2339 | 550 | 0.0005 | - | | |
| | 0.2552 | 600 | 0.0006 | - | | |
| | 0.2765 | 650 | 0.0005 | - | | |
| | 0.2977 | 700 | 0.0002 | - | | |
| | 0.3190 | 750 | 0.0005 | - | | |
| | 0.3403 | 800 | 0.0003 | - | | |
| | 0.3615 | 850 | 0.0003 | - | | |
| | 0.3828 | 900 | 0.0002 | - | | |
| | 0.4041 | 950 | 0.0003 | - | | |
| | 0.4254 | 1000 | 0.0002 | - | | |
| | 0.4466 | 1050 | 0.0002 | - | | |
| | 0.4679 | 1100 | 0.0001 | - | | |
| | 0.4892 | 1150 | 0.0002 | - | | |
| | 0.5104 | 1200 | 0.0002 | - | | |
| | 0.5317 | 1250 | 0.0001 | - | | |
| | 0.5530 | 1300 | 0.0002 | - | | |
| | 0.5742 | 1350 | 0.0002 | - | | |
| | 0.5955 | 1400 | 0.0001 | - | | |
| | 0.6168 | 1450 | 0.0002 | - | | |
| | 0.6380 | 1500 | 0.0002 | - | | |
| | 0.6593 | 1550 | 0.0001 | - | | |
| | 0.6806 | 1600 | 0.0001 | - | | |
| | 0.7018 | 1650 | 0.0001 | - | | |
| | 0.7231 | 1700 | 0.0001 | - | | |
| | 0.7444 | 1750 | 0.0001 | - | | |
| | 0.7656 | 1800 | 0.0001 | - | | |
| | 0.7869 | 1850 | 0.0001 | - | | |
| | 0.8082 | 1900 | 0.0001 | - | | |
| | 0.8294 | 1950 | 0.0001 | - | | |
| | 0.8507 | 2000 | 0.0001 | - | | |
| | 0.8720 | 2050 | 0.0001 | - | | |
| | 0.8932 | 2100 | 0.0001 | - | | |
| | 0.9145 | 2150 | 0.0002 | - | | |
| | 0.9358 | 2200 | 0.0002 | - | | |
| | 0.9570 | 2250 | 0.0002 | - | | |
| | 0.9783 | 2300 | 0.0001 | - | | |
| | 0.9996 | 2350 | 0.0001 | - | | |
| | 1.0208 | 2400 | 0.0001 | - | | |
| | 1.0421 | 2450 | 0.0002 | - | | |
| | 1.0634 | 2500 | 0.0001 | - | | |
| | 1.0846 | 2550 | 0.0001 | - | | |
| | 1.1059 | 2600 | 0.0001 | - | | |
| | 1.1272 | 2650 | 0.0002 | - | | |
| | 1.1484 | 2700 | 0.0001 | - | | |
| | 1.1697 | 2750 | 0.0001 | - | | |
| | 1.1910 | 2800 | 0.0001 | - | | |
| | 1.2123 | 2850 | 0.0001 | - | | |
| | 1.2335 | 2900 | 0.0001 | - | | |
| | 1.2548 | 2950 | 0.0001 | - | | |
| | 1.2761 | 3000 | 0.0001 | - | | |
| | 1.2973 | 3050 | 0.0001 | - | | |
| | 1.3186 | 3100 | 0.0001 | - | | |
| | 1.3399 | 3150 | 0.0001 | - | | |
| | 1.3611 | 3200 | 0.0001 | - | | |
| | 1.3824 | 3250 | 0.0001 | - | | |
| | 1.4037 | 3300 | 0.0001 | - | | |
| | 1.4249 | 3350 | 0.0001 | - | | |
| | 1.4462 | 3400 | 0.0001 | - | | |
| | 1.4675 | 3450 | 0.0001 | - | | |
| | 1.4887 | 3500 | 0.0001 | - | | |
| | 1.5100 | 3550 | 0.0001 | - | | |
| | 1.5313 | 3600 | 0.0001 | - | | |
| | 1.5525 | 3650 | 0.0001 | - | | |
| | 1.5738 | 3700 | 0.0001 | - | | |
| | 1.5951 | 3750 | 0.0001 | - | | |
| | 1.6163 | 3800 | 0.0001 | - | | |
| | 1.6376 | 3850 | 0.0 | - | | |
| | 1.6589 | 3900 | 0.0001 | - | | |
| | 1.6801 | 3950 | 0.0001 | - | | |
| | 1.7014 | 4000 | 0.0001 | - | | |
| | 1.7227 | 4050 | 0.0001 | - | | |
| | 1.7439 | 4100 | 0.0001 | - | | |
| | 1.7652 | 4150 | 0.0001 | - | | |
| | 1.7865 | 4200 | 0.0001 | - | | |
| | 1.8077 | 4250 | 0.0001 | - | | |
| | 1.8290 | 4300 | 0.0001 | - | | |
| | 1.8503 | 4350 | 0.0001 | - | | |
| | 1.8715 | 4400 | 0.0 | - | | |
| | 1.8928 | 4450 | 0.0001 | - | | |
| | 1.9141 | 4500 | 0.0001 | - | | |
| | 1.9353 | 4550 | 0.0001 | - | | |
| | 1.9566 | 4600 | 0.0001 | - | | |
| | 1.9779 | 4650 | 0.0001 | - | | |
| | 1.9991 | 4700 | 0.0001 | - | | |
| ### Framework Versions | |
| - Python: 3.10.16 | |
| - SetFit: 1.0.3 | |
| - Sentence Transformers: 2.7.0 | |
| - Transformers: 4.40.2 | |
| - PyTorch: 2.2.2 | |
| - Datasets: 2.19.1 | |
| - 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} | |
| } | |
| ``` | |
| <!-- | |
| ## Glossary | |
| *Clearly define terms in order to be accessible across audiences.* | |
| --> | |
| <!-- | |
| ## Model Card Authors | |
| *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* | |
| --> | |
| <!-- | |
| ## Model Card Contact | |
| *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* | |
| --> |