SetFit with Hcompany/NeoMME-260M-Retriever-ST-dense

This is a SetFit model that can be used for Text Classification. This SetFit model uses Hcompany/NeoMME-260M-Retriever-ST-dense 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. Fine-tuning a Sentence Transformer with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

Model Sources

Model Labels

Label Examples
questionnaire
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185FA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184E90>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=613x800 at 0x7F042C184E90>
invoice
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C1861E0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C186AB0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184710>
advertisement
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184E90>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=617x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184E90>
scientific publication
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186030>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=632x800 at 0x7F042C184E90>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DF0>
letter
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=618x800 at 0x7F042C185DF0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DC0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=628x800 at 0x7F042C1861E0>
file folder
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186BA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=610x800 at 0x7F042C184E90>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DF0>
form
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DC0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=642x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C186720>
email
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185FA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C1861E0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186BA0>
budget
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C186AB0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=662x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=621x800 at 0x7F042C186720>
specification
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=629x800 at 0x7F042C185FA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=627x800 at 0x7F042C186030>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=722x800 at 0x7F042C186AB0>
news article
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=579x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DC0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=628x800 at 0x7F042C186BA0>
scientific report
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=615x800 at 0x7F042C186030>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C184E90>
handwritten
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185FA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186BA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=617x800 at 0x7F042C185DF0>
resume
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186030>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184710>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C185DC0>
presentation
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=622x800 at 0x7F042C1861E0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C186BA0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184E90>
memo
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=610x800 at 0x7F042C185DC0>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=603x800 at 0x7F042C184E90>
  • <PIL.PngImagePlugin.PngImageFile image mode=RGB size=610x800 at 0x7F042C184710>

Uses

Direct Use for Inference

First install the SetFit library:

pip install setfit

Then you can load this model and run inference.

from PIL import Image

from setfit import SetFitModel

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("oneryalcin/rvl-cdip-setfit-neomme")
# Run inference on images
preds = model([Image.open("example.png")])

Training Details

Training Hyperparameters

  • batch_size: (4, 4)
  • num_epochs: (1, 1)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 5
  • 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
  • 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.0031 1 0.1619 -
0.1562 50 0.2096 -
0.3125 100 0.1618 -
0.4688 150 0.1933 -
0.625 200 0.1195 -
0.7812 250 0.1068 -
0.9375 300 0.0836 -

Framework Versions

  • Python: 3.12.12
  • SetFit: 1.3.0.dev0
  • Sentence Transformers: 6.0.1
  • Transformers: 5.17.0
  • PyTorch: 2.14.0+cu130
  • Datasets: 5.0.1
  • Tokenizers: 0.23.2

Citation

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

Evaluation (jordyvl/rvl_cdip_100_examples_per_class, split test)

accuracy 0.532, macro F1 0.516 on 400 images; 8 training images per class; body Hcompany/NeoMME-260M-Retriever-ST-dense, task document; trained in 769s on cuda.

                        precision    recall  f1-score   support

         advertisement       0.56      0.76      0.64        25
                budget       0.41      0.28      0.33        25
                 email       0.64      0.56      0.60        25
           file folder       0.54      0.76      0.63        25
                  form       0.41      0.48      0.44        25
           handwritten       0.83      0.76      0.79        25
               invoice       0.33      0.24      0.28        25
                letter       0.58      0.60      0.59        25
                  memo       0.30      0.32      0.31        25
          news article       0.50      0.64      0.56        25
          presentation       0.33      0.24      0.28        25
         questionnaire       0.38      0.36      0.37        25
                resume       1.00      0.92      0.96        25
scientific publication       0.61      0.76      0.68        25
     scientific report       0.43      0.12      0.19        25
         specification       0.53      0.72      0.61        25

              accuracy                           0.53       400
             macro avg       0.52      0.53      0.52       400
          weighted avg       0.52      0.53      0.52       400
Downloads last month
31
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for oneryalcin/rvl-cdip-setfit-neomme

Paper for oneryalcin/rvl-cdip-setfit-neomme