CoolFace
Modelpublic

MiguelRod/SetFit-MeSH-Biomaterials-Classifier

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes6downloads
Model Card

SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext

This is a SetFit model that can be used for Text Classification. This SetFit model uses cambridgeltl/SapBERT-from-PubMedBERT-fulltext as the Sentence Transformer embedding model. A OneVsRestClassifier 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: cambridgeltl/SapBERT-from-PubMedBERT-fulltext
  • Classification head: a OneVsRestClassifier instance
  • Maximum Sequence Length: 512 tokens <!-- - Number of Classes: Unknown --> <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Evaluation

Metrics

LabelAccuracy
all0.5241

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("foreign-body reaction: Chronic inflammation and granuloma formation around irritating foreign bodies.")

<!--

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

Training Hyperparameters

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

Training Results

EpochStepTraining LossValidation Loss
0.000310.2929-
0.0136500.2377-
0.02721000.2321-
0.04081500.2199-
0.05442000.1726-
0.06802500.1355-
0.08163000.1207-
0.09523500.1138-
0.10884000.1154-
0.12234500.095-
0.13595000.106-
0.14955500.0913-
0.16316000.0943-
0.17676500.0974-
0.19037000.0923-
0.20397500.0893-
0.21758000.0804-
0.23118500.0849-
0.24479000.0766-
0.25839500.0838-
0.271910000.0725-
0.285510500.073-
0.299111000.055-
0.312711500.0758-
0.326312000.0709-
0.339912500.0569-
0.353513000.0535-
0.367013500.0557-
0.380614000.0596-
0.394214500.0453-
0.407815000.0428-
0.421415500.0482-
0.435016000.0465-
0.448616500.0469-
0.462217000.0479-
0.475817500.0451-
0.489418000.0613-
0.503018500.0533-
0.516619000.0476-
0.530219500.0449-
0.543820000.0543-
0.557420500.0509-
0.571021000.043-
0.584621500.0482-
0.598222000.0513-
0.611722500.0366-
0.625323000.0385-
0.638923500.0446-
0.652524000.0411-
0.666124500.037-
0.679725000.0321-
0.693325500.0468-
0.706926000.0331-
0.720526500.0315-
0.734127000.0435-
0.747727500.0394-
0.761328000.0381-
0.774928500.0418-
0.788529000.0347-
0.802129500.0468-
0.815730000.0352-
0.829330500.0416-
0.842831000.0354-
0.856431500.0329-
0.870032000.0359-
0.883632500.036-
0.897233000.0362-
0.910833500.0296-
0.924434000.041-
0.938034500.0375-
0.951635000.0282-
0.965235500.0341-
0.978836000.0283-
0.992436500.0339-

Framework Versions

  • Python: 3.11.11
  • SetFit: 1.1.1
  • Sentence Transformers: 3.4.1
  • Transformers: 4.50.0
  • PyTorch: 2.6.0+cu124
  • Datasets: 3.4.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}
}

<!--

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