MiguelRod's picture
Upload folder using huggingface_hub
d402ee3 verified
|
raw
history blame contribute delete
10.1 kB
---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: 'lymphocyte activation: Morphologic alteration of small B LYMPHOCYTES or T
LYMPHOCYTES in culture into large blast-like cells able to synthesize DNA and
RNA and to divide mitotically. It is induced by INTERLEUKINS; MITOGENS such as
PHYTOHEMAGGLUTININS, and by specific ANTIGENS. It may also occur in vivo as in
GRAFT REJECTION.'
- text: 'burns: Injuries to tissues caused by contact with heat, steam, chemicals
(BURNS, CHEMICAL), electricity (BURNS, ELECTRIC), or the like.'
- text: 'solutions: "The homogeneous mixtures formed by the mixing of a solid, liquid,
or gaseous substance (solute) with a liquid (the solvent), from which the dissolved
substances can be recovered by physical processes. (From Grant & Hackhs Chemical
Dictionary, 5th ed)"'
- text: 'tooth discoloration: Any change in the hue, color, or translucency of a tooth
due to any cause. Restorative filling materials, drugs (both topical and systemic),
pulpal necrosis, or hemorrhage may be responsible. (Jablonski, Dictionary of Dentistry,
1992, p253)'
- text: 'foreign-body reaction: Chronic inflammation and granuloma formation around
irritating foreign bodies.'
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: false
base_model: cambridgeltl/SapBERT-from-PubMedBERT-fulltext
model-index:
- name: SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Unknown
type: unknown
split: test
metrics:
- type: accuracy
value: 0.5240963855421686
name: Accuracy
---
# SetFit with cambridgeltl/SapBERT-from-PubMedBERT-fulltext
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [cambridgeltl/SapBERT-from-PubMedBERT-fulltext](https://huggingface.co/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. 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:** [cambridgeltl/SapBERT-from-PubMedBERT-fulltext](https://huggingface.co/cambridgeltl/SapBERT-from-PubMedBERT-fulltext)
- **Classification head:** a OneVsRestClassifier instance
- **Maximum Sequence Length:** 512 tokens
<!-- - **Number of Classes:** Unknown -->
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### 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)
## Evaluation
### Metrics
| Label | Accuracy |
|:--------|:---------|
| **all** | 0.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 set | Min | Median | Max |
|:-------------|:----|:--------|:----|
| Word count | 2 | 30.4473 | 134 |
### Training Hyperparameters
- batch_size: (16, 16)
- 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.0003 | 1 | 0.2929 | - |
| 0.0136 | 50 | 0.2377 | - |
| 0.0272 | 100 | 0.2321 | - |
| 0.0408 | 150 | 0.2199 | - |
| 0.0544 | 200 | 0.1726 | - |
| 0.0680 | 250 | 0.1355 | - |
| 0.0816 | 300 | 0.1207 | - |
| 0.0952 | 350 | 0.1138 | - |
| 0.1088 | 400 | 0.1154 | - |
| 0.1223 | 450 | 0.095 | - |
| 0.1359 | 500 | 0.106 | - |
| 0.1495 | 550 | 0.0913 | - |
| 0.1631 | 600 | 0.0943 | - |
| 0.1767 | 650 | 0.0974 | - |
| 0.1903 | 700 | 0.0923 | - |
| 0.2039 | 750 | 0.0893 | - |
| 0.2175 | 800 | 0.0804 | - |
| 0.2311 | 850 | 0.0849 | - |
| 0.2447 | 900 | 0.0766 | - |
| 0.2583 | 950 | 0.0838 | - |
| 0.2719 | 1000 | 0.0725 | - |
| 0.2855 | 1050 | 0.073 | - |
| 0.2991 | 1100 | 0.055 | - |
| 0.3127 | 1150 | 0.0758 | - |
| 0.3263 | 1200 | 0.0709 | - |
| 0.3399 | 1250 | 0.0569 | - |
| 0.3535 | 1300 | 0.0535 | - |
| 0.3670 | 1350 | 0.0557 | - |
| 0.3806 | 1400 | 0.0596 | - |
| 0.3942 | 1450 | 0.0453 | - |
| 0.4078 | 1500 | 0.0428 | - |
| 0.4214 | 1550 | 0.0482 | - |
| 0.4350 | 1600 | 0.0465 | - |
| 0.4486 | 1650 | 0.0469 | - |
| 0.4622 | 1700 | 0.0479 | - |
| 0.4758 | 1750 | 0.0451 | - |
| 0.4894 | 1800 | 0.0613 | - |
| 0.5030 | 1850 | 0.0533 | - |
| 0.5166 | 1900 | 0.0476 | - |
| 0.5302 | 1950 | 0.0449 | - |
| 0.5438 | 2000 | 0.0543 | - |
| 0.5574 | 2050 | 0.0509 | - |
| 0.5710 | 2100 | 0.043 | - |
| 0.5846 | 2150 | 0.0482 | - |
| 0.5982 | 2200 | 0.0513 | - |
| 0.6117 | 2250 | 0.0366 | - |
| 0.6253 | 2300 | 0.0385 | - |
| 0.6389 | 2350 | 0.0446 | - |
| 0.6525 | 2400 | 0.0411 | - |
| 0.6661 | 2450 | 0.037 | - |
| 0.6797 | 2500 | 0.0321 | - |
| 0.6933 | 2550 | 0.0468 | - |
| 0.7069 | 2600 | 0.0331 | - |
| 0.7205 | 2650 | 0.0315 | - |
| 0.7341 | 2700 | 0.0435 | - |
| 0.7477 | 2750 | 0.0394 | - |
| 0.7613 | 2800 | 0.0381 | - |
| 0.7749 | 2850 | 0.0418 | - |
| 0.7885 | 2900 | 0.0347 | - |
| 0.8021 | 2950 | 0.0468 | - |
| 0.8157 | 3000 | 0.0352 | - |
| 0.8293 | 3050 | 0.0416 | - |
| 0.8428 | 3100 | 0.0354 | - |
| 0.8564 | 3150 | 0.0329 | - |
| 0.8700 | 3200 | 0.0359 | - |
| 0.8836 | 3250 | 0.036 | - |
| 0.8972 | 3300 | 0.0362 | - |
| 0.9108 | 3350 | 0.0296 | - |
| 0.9244 | 3400 | 0.041 | - |
| 0.9380 | 3450 | 0.0375 | - |
| 0.9516 | 3500 | 0.0282 | - |
| 0.9652 | 3550 | 0.0341 | - |
| 0.9788 | 3600 | 0.0283 | - |
| 0.9924 | 3650 | 0.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.*
-->