CoolFace
Modelpublic

ppsingh/iki_sector_setfit

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes5downloads
Model Card

SetFit with ppsingh/SECTOR-multilabel-mpnet_w

This is a SetFit model that can be used for Text Classification. This SetFit model uses ppsingh/SECTOR-multilabel-mpnet_w as the Sentence Transformer embedding model. A SetFitHead instance is used for classification.

The model has been trained using an efficient few-shot learning technique that involves:

  1. 1.Fine-tuning a Sentence Transformer with contrastive learning.
  2. 2.Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

  • Model Type: SetFit
  • Sentence Transformer body: ppsingh/SECTOR-multilabel-mpnet_w
  • Classification head: a SetFitHead instance
  • Maximum Sequence Length: 512 tokens
  • Number of Classes: 4 classes <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

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("ppsingh/iki_sector_setfit")
# Run inference
preds = model("In the shipping and aviation sectors, emission reduction efforts will be focused on distributing eco-friendly ships and enhancing the operational efficiency of aircraft. Agriculture, livestock farming and fisheries: The Republic Korea is introducing various options to accelerate low-carbon farming, for instance, improving irrigation techniques in rice paddies and adopting low-input systems for nitrogen fertilizers.")

<!--

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 setMinMedianMax
Word count3576.164170
  • Training Dataset: 250 | Class | Positive Count of Class| |:-------------|:--------| | Economy-wide | 88 | | Energy | 63 | | Other Sector | 64 | | Transport | 139 |
  • Validation Dataset: 42 | Class | Positive Count of Class| |:-------------|:--------| | Economy-wide | 15 | | Energy | 11 | | Other Sector | 11 | | Transport | 24 |

Training Hyperparameters

  • batch_size: (16, 2)
  • num_epochs: (1, 10)
  • max_steps: -1
  • sampling_strategy: oversampling
  • bodylearningrate: (2e-05, 1e-05)
  • headlearningrate: 0.01
  • loss: CosineSimilarityLoss
  • distancemetric: cosinedistance
  • margin: 0.25
  • endtoend: False
  • use_amp: False
  • warmup_proportion: 0.01
  • seed: 42
  • evalmaxsteps: -1
  • loadbestmodelatend: False

Training Results

EpochStepTraining LossValidation Loss
0.000510.2029-
0.09932000.01110.1124
0.19854000.00630.111
0.29786000.01830.1214
0.39708000.01970.1248
0.496310000.03870.1339
0.595512000.00260.1181
0.694814000.03780.1208
0.794016000.02850.1267
0.893318000.01290.1254
0.992620000.03410.1271

Classifier Training Results

EpochTraining F1-microTraining F1-SamplesTraining F1-weightedValidation F1-microValidation F1-samplesValidation F1-weighted
00.9540.9720.9450.8240.8190.813
10.9940.9960.9940.8500.8320.852
20.9810.9890.9790.8500.8430.852
30.9950.9970.9950.8520.8430.858
40.9940.9960.9940.8520.8430.858
50.9950.9970.9950.8590.8480.863
labelprecisionrecallf1-scoresupport
Economy-wide0.8570.8000.82715.0
Energy1.000.8180.90011.0
Other Sector0.6150.7270.66711.0
Transport0.9580.9580.95824.0
  • Micro Avg: Precision = 0.866, Recall = 0.852, F1 = 0.859504
  • Samples Avg: Precision = 0.869, Recall = 0.861, F1 = 0.848

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • Carbon Emitted: 0.026 kg of CO2
  • Hours Used: 0.622 hours

Training Hardware

  • On Cloud: No
  • GPU Model: 1 x Tesla T4
  • CPU Model: Intel(R) Xeon(R) CPU @ 2.00GHz
  • RAM Size: 12.67 GB

Framework Versions

  • Python: 3.10.12
  • SetFit: 1.0.3
  • Sentence Transformers: 2.3.1
  • Transformers: 4.35.2
  • PyTorch: 2.1.0+cu121
  • Datasets: 2.3.0
  • Tokenizers: 0.15.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. -->