--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: Как подать документы, если я нахожусь в другом городе? - text: Какие перспективы после окончания ВУЦ? - text: Как проходит апелляция по результатам экзаменов? - text: Как узнать, какие документы нужны для поступления на магистратуру? - text: Какие достижения учитываются для аспирантуры? metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true base_model: cointegrated/rubert-tiny2 model-index: - name: SetFit with cointegrated/rubert-tiny2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.7857142857142857 name: Accuracy --- # SetFit with cointegrated/rubert-tiny2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [cointegrated/rubert-tiny2](https://huggingface.co/cointegrated/rubert-tiny2) 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:** [cointegrated/rubert-tiny2](https://huggingface.co/cointegrated/rubert-tiny2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 2048 tokens - **Number of Classes:** 8 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 | |:------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 4 | | | 1 | | | 3 | | | 2 | | | 5 | | | 7 | | | 0 | | | 6 | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.7857 | ## 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("Maxim01/Intent_Classification_Test") # Run inference preds = model("Какие перспективы после окончания ВУЦ?") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 3 | 6.7143 | 11 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 33 | | 1 | 32 | | 2 | 32 | | 3 | 33 | | 4 | 31 | | 5 | 15 | | 6 | 15 | | 7 | 33 | ### Training Hyperparameters - batch_size: (8, 8) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 20 - 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.0009 | 1 | 0.1623 | - | | 0.0446 | 50 | 0.2355 | - | | 0.0893 | 100 | 0.1756 | - | | 0.1339 | 150 | 0.1501 | - | | 0.1786 | 200 | 0.1329 | - | | 0.2232 | 250 | 0.119 | - | | 0.2679 | 300 | 0.1048 | - | | 0.3125 | 350 | 0.0928 | - | | 0.3571 | 400 | 0.0902 | - | | 0.4018 | 450 | 0.0841 | - | | 0.4464 | 500 | 0.0903 | - | | 0.4911 | 550 | 0.0969 | - | | 0.5357 | 600 | 0.0747 | - | | 0.5804 | 650 | 0.0704 | - | | 0.625 | 700 | 0.0809 | - | | 0.6696 | 750 | 0.0793 | - | | 0.7143 | 800 | 0.0711 | - | | 0.7589 | 850 | 0.0687 | - | | 0.8036 | 900 | 0.0726 | - | | 0.8482 | 950 | 0.0718 | - | | 0.8929 | 1000 | 0.0751 | - | | 0.9375 | 1050 | 0.0635 | - | | 0.9821 | 1100 | 0.0723 | - | ### Framework Versions - Python: 3.11.12 - SetFit: 1.1.2 - Sentence Transformers: 3.4.1 - Transformers: 4.51.3 - PyTorch: 2.6.0+cu124 - Datasets: 3.5.1 - Tokenizers: 0.21.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} } ```