CoolFace
Modelpublic

akhooli/setfit_ar_ubc_hs

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes9downloads
Model Card

SetFit with akhooli/sbertarnli500kubc_norm

This is a SetFit model that can be used for Text Classification. This SetFit model uses akhooli/sbert_ar_nli_500k_ubc_norm as the Sentence Transformer embedding model. A LogisticRegression 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: akhooli/sbert_ar_nli_500k_ubc_norm
  • —Classification head: a LogisticRegression instance
  • —Maximum Sequence Length: 512 tokens
  • —Number of Classes: 2 classes <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Model Labels

LabelExamples
positive<ul><li>' سبحان الله الفلسطينيين شعب خاين في كل مكان \nلاحول ولا قوة إلا بالله'</li><li>'يا بيك عّم تخبرنا عن شي ما فينا تعملو نحن ماًعندنا نواب ولا وزراء بمثلونا بالدولة الا اذا زهقان وعبالك ليك'</li><li>'جوز كذابين منافقين...'</li></ul>
negative<ul><li>'ربي لا تجعلني أسيء الظن بأحد ولا تجعل في قلبي شيئا على أحد ، اللهم أسألك قلباً نقياً صافيا'</li><li>'هشام حداد عامل فيها جون ستيوارت'</li><li>' بحياة اختك من وين بتجيبي اخبارك؟؟ من صغري وانا عبالي كون... LINK'</li></ul>

Evaluation

Metrics

LabelAccuracy
all0.8398

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("akhooli/setfit_ar_ubc_hs")
# Run inference
preds = model("شيوعي 
علماني 
مسيحي
انصار سنه 
صوفي 
يمثلك التجمع 
لا يمثلك التجمع 
اهلا بكم جميعا فنحن نريد بناء وطن ❤")

<!--

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 count118.8448185
LabelTraining Sample Count
negative5200
positive4943

Training Hyperparameters

  • —batch_size: (32, 32)
  • —num_epochs: (1, 1)
  • —max_steps: 6000
  • —sampling_strategy: undersampling
  • —bodylearningrate: (2e-05, 1e-05)
  • —headlearningrate: 0.01
  • —loss: CosineSimilarityLoss
  • —distancemetric: cosinedistance
  • —margin: 0.25
  • —endtoend: False
  • —use_amp: False
  • —warmup_proportion: 0.1
  • —l2_weight: 0.01
  • —seed: 42
  • —runname: setfithate52kubc_6k
  • —evalmaxsteps: -1
  • —loadbestmodelatend: False

Training Results

EpochStepTraining LossValidation Loss
0.000310.297-
0.03331000.2741-
0.06672000.2178-
0.13000.1724-
0.13334000.1449-
0.16675000.1137-
0.26000.0902-
0.23337000.0708-
0.26678000.0535-
0.39000.0483-
0.333310000.0386-
0.366711000.0319-
0.412000.0279-
0.433313000.0201-
0.466714000.0234-
0.515000.0151-
0.533316000.0151-
0.566717000.0137-
0.618000.0117-
0.633319000.011-
0.666720000.0097-
0.721000.0077-
0.733322000.0089-
0.766723000.0069-
0.824000.0064-
0.833325000.0083-
0.866726000.0061-
0.927000.0063-
0.933328000.0051-
0.966729000.0047-
1.030000.0044-
1.033331000.0035-
1.066732000.0034-
1.133000.0035-
1.133334000.0043-
1.166735000.0035-
1.236000.0024-
1.233337000.003-
1.266738000.002-
1.339000.0029-
1.333340000.003-
1.366741000.002-
1.442000.0022-
1.433343000.0027-
1.466744000.004-
1.545000.001-
1.533346000.0027-
1.566747000.0027-
1.648000.0014-
1.633349000.0022-
1.666750000.0027-
1.751000.0018-
1.733352000.0018-
1.766753000.0012-
1.854000.0014-
1.833355000.0015-
1.866756000.0009-
1.957000.0012-
1.933358000.0009-
1.966759000.001-
2.060000.0007-

Framework Versions

  • —Python: 3.10.14
  • —SetFit: 1.2.0.dev0
  • —Sentence Transformers: 3.3.0
  • —Transformers: 4.45.1
  • —PyTorch: 2.4.0
  • —Datasets: 3.0.1
  • —Tokenizers: 0.20.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}
}

<!--

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. -->