1from span_marker import SpanMarkerModel
23# Download from the 🤗 Hub4model = SpanMarkerModel.from_pretrained("iahlt/span-marker-alephbert-small-nemo-mt-he")5# Run inference6entities = model.predict("יו\"ר ועדת ה נוער נתן סלובטיק אמר ש ה שחקנים של אנחנו לא משתלבים ב אירופה.")7entities
Using spacy
pip install spacy_udpipe
python
1import spacy
2from spacy.lang.he import Hebrew
3import spacy_udpipe
45spacy_udpipe.download("he")# download public udpipe model, but possible to use any your spacy model6nlp = spacy_udpipe.load("he")7nlp.add_pipe("span_marker", config={"model":"iahlt/span-marker-alephbert-small-nemo-mt-he"})89text ="יו\"ר ועדת הנוער נתן סלובטיק אמר שהשחקנים של אנחנו לא משתלבים באירופה."10doc = nlp(text)11print([(entity, entity.label_)for entity in doc.ents])12# [(ועדת הנוער, 'ORG'), (נתן סלובטיק, 'PER'), (אירופה, 'GPE')]
Training Details
Training Set Metrics
Training set
Min
Median
Max
Sentence length
1
25.4427
117
Entities per sentence
0
1.2472
20
Training Hyperparameters
learning_rate: 1e-05
train_batch_size: 2
eval_batch_size: 2
seed: 42
gradient_accumulation_steps: 2
total_train_batch_size: 4
optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
lr_scheduler_type: linear
lr_scheduler_warmup_ratio: 0.1
num_epochs: 4
mixed_precision_training: Native AMP
Evaluation results
0
eval_loss
0.00487611
eval_overall_precision
0.822917
eval_overall_recall
0.791583
eval_overall_f1
0.806946
eval_overall_accuracy
0.969029
Test results
0
test_loss
0.00652107
test_overall_precision
0.747289
test_overall_recall
0.73927
test_overall_f1
0.743258
test_overall_accuracy
0.960126
Framework Versions
Python: 3.10.12
SpanMarker: 1.5.0
Transformers: 4.35.2
PyTorch: 2.1.0+cu118
Datasets: 2.15.0
Tokenizers: 0.15.0
Citation
BibTeX
@software{Aarsen_SpanMarker,
author = {Aarsen, Tom},
license = {Apache-2.0},
title = {{SpanMarker for Named Entity Recognition}},
url = {https://github.com/tomaarsen/SpanMarkerNER}
}