Instructions to use ytu-ce-cosmos/modernbert-tr-pii-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ytu-ce-cosmos/modernbert-tr-pii-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ytu-ce-cosmos/modernbert-tr-pii-ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ytu-ce-cosmos/modernbert-tr-pii-ner") model = AutoModelForTokenClassification.from_pretrained("ytu-ce-cosmos/modernbert-tr-pii-ner", device_map="auto") - encoderfile
How to use ytu-ce-cosmos/modernbert-tr-pii-ner with encoderfile:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
ModernBERT-TR PII Recognition
A 150M-parameter Turkish token classifier with 25 KVKK-oriented entity types and 51 BIO labels.
Results
Our model scores 80.85 +/- 0.19% overlap micro-F2 on a 300-document test set. The released checkpoint scores 81.01%.
The quantized int8 version scores 71.90% overlap micro-F2.
Usage
from transformers import pipeline
detect = pipeline(
"token-classification",
model="ytu-ce-cosmos/modernbert-tr-pii-ner",
aggregation_strategy="first",
)
detect("Ayşe Yılmaz'a ayse@example.com adresinden ulaşabilirsiniz.")
You can call the tokenizer with is_split_into_words=True to allow the tokenizer to split the sentence into words, and keep the first WordPiece label for each word.
Training
We finetune ytu-ce-cosmos/modernbert-tr-base on an 8,014-document mixture of Turkish web PDFs, anonymized high-court decisions, born-labeled synthetic documents, and OCR-degraded synthetic documents; the loader retained 7,763 training documents. Real-document labels came from up to a three-model panel. We use learning rate 2e-5, batch size 16, three epochs, cosine decay, 10% warmup, weight decay 0.01, normalized inverse-frequency weights raised to 0.3, and three seeds.
Standalone binaries are available in the encoderfile repo.
License
Apache-2.0.
- Downloads last month
- 260