tomaarsen/span-marker-bert-base-uncased-acronyms

token classificationspan-markerenspan-markerpytorchtensorboardsafetensorstoken-classificationnerapache-2.0
239.4K

SpanMarker with bert-base-uncased on Acronym Identification

This is a SpanMarker model trained on the Acronym Identification dataset that can be used for Named Entity Recognition. This SpanMarker model uses bert-base-uncased as the underlying encoder. See train.py for the training script.

Is your data always capitalized correctly? Then consider using the cased variant of this model instead for better performance: tomaarsen/span-marker-bert-base-acronyms.

Model Details

Model Description

Model Sources

Model Labels

LabelExamples
long"successive convex approximation", "controlled natural language", "Conversational Question Answering"
short"SODA", "CNL", "CoQA"

Evaluation

Metrics

LabelPrecisionRecallF1
all0.93390.90630.9199
long0.93140.88450.9074
short0.93520.91740.9262

Uses

Direct Use for Inference

from span_marker import SpanMarkerModel

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-uncased-acronyms")
# Run inference
entities = model.predict("compression algorithms like principal component analysis (pca) can reduce noise and complexity.")

Downstream Use

You can finetune this model on your own dataset.

Click to expand
from span_marker import SpanMarkerModel, Trainer

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-uncased-acronyms")

# Specify a Dataset with "tokens" and "ner_tag" columns
dataset = load_dataset("conll2003") # For example CoNLL2003

# Initialize a Trainer using the pretrained model & dataset
trainer = Trainer(
    model=model,
    train_dataset=dataset["train"],
    eval_dataset=dataset["validation"],
)
trainer.train()
trainer.save_model("tomaarsen/span-marker-bert-base-uncased-acronyms-finetuned")

Training Details

Training Set Metrics

Training setMinMedianMax
Sentence length432.3372170
Entities per sentence02.677524

Training Hyperparameters

  • learning_rate: 5e-05
  • train_batch_size: 32
  • eval_batch_size: 32
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_ratio: 0.1
  • num_epochs: 2

Training Results

EpochStepValidation LossValidation PrecisionValidation RecallValidation F1Validation Accuracy
0.31202000.00970.89990.87310.88630.9718
0.62404000.00750.91630.89950.90780.9769
0.93606000.00760.90790.91530.91160.9773
1.24808000.00690.92670.90060.91350.9778
1.560110000.00650.92680.90440.91540.9782
1.872112000.00650.92790.90610.91680.9787

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • Carbon Emitted: 0.031 kg of CO2
  • Hours Used: 0.272 hours

Training Hardware

  • On Cloud: No
  • GPU Model: 1 x NVIDIA GeForce RTX 3090
  • CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
  • RAM Size: 31.78 GB

Framework Versions

  • Python: 3.9.16
  • SpanMarker: 1.3.1.dev
  • Transformers: 4.30.0
  • PyTorch: 2.0.1+cu118
  • Datasets: 2.14.0
  • Tokenizers: 0.13.2

Citation

BibTeX

@software{Aarsen_SpanMarker,
    author = {Aarsen, Tom},
    license = {Apache-2.0},
    title = {{SpanMarker for Named Entity Recognition}},
    url = {https://github.com/tomaarsen/SpanMarkerNER}
}
DEPLOY IN 60 SECONDS

Run span-marker-bert-base-uncased-acronyms on Runcrate

Deploy on H100, A100, or RTX GPUs. Pay only for what you use. No setup required.