Views
No views yet
1{
2 "hidden_size": 768,
3 "intermediate_size": 1152,
4 "num_attention_heads": 12,
5 "num_hidden_layers": 22,
6 "max_position_embeddings": 8192,
7 "vocab_size": 50280,
8 "global_attn_every_n_layers": 3,
9 "local_attention": 128,
10 "global_rope_theta": 160000.0,
11 "local_rope_theta": 10000.0,
12 "architectures": ["ModernBertForMaskedLM"],
13 "model_type": "modernbert",
14 "cls_token_id": 3,
15 "mask_token_id": 6,
16 "pad_token_id": 5,
17 "sep_token_id": 4,
18 "unk_token_id": 2
19}
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| 0 | 92.13% | 92.43% | 92.28% | 1,849 |
| 1 | 93.63% | 93.70% | 93.67% | 3,937 |
| 2 | 90.70% | 90.70% | 90.70% | 2,075 |
| 3 | 96.30% | 93.81% | 95.04% | 776 |
| 4 | 96.09% | 95.84% | 95.96% | 1,898 |
| 5 | 89.24% | 87.99% | 88.61% | 641 |
| 6 | 98.55% | 99.37% | 98.96% | 3,005 |
1from transformers import AutoTokenizer, AutoModel
2
3# Load model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("NAMAA-Space/AraModernBERT-Base-V1.0")
5model = AutoModel.from_pretrained("NAMAA-Space/AraModernBERT-Base-V1.0")
6
7# Encode text
8text = "مرحبا بكم في عالم الذكاء الاصطناعي"
9inputs = tokenizer(text, return_tensors="pt")
10outputs = model(**inputs)
11
12# Get embeddings
13embeddings = outputs.last_hidden_state1from transformers import AutoTokenizer, AutoModelForMaskedLM
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("NAMAA-Space/AraModernBERT-Base-V1.0")
5model = AutoModelForMaskedLM.from_pretrained("NAMAA-Space/AraModernBERT-Base-V1.0")
6
7text = "الذكاء الاصطناعي هو [MASK] المستقبل."
8inputs = tokenizer(text, return_tensors="pt")
9token_index = torch.where(inputs["input_ids"][0] == tokenizer.mask_token_id)[0]
10
11outputs = model(**inputs)
12predictions = outputs.logits
13predicted_token_id = torch.argmax(predictions[0, token_index]).item()
14predicted_token = tokenizer.decode(predicted_token_id)
15print(predicted_token) @inproceedings{elshehy-etal-2026-aramodernbert,
title = "{A}ra{M}odern{BERT}: Transtokenized Initialization and Long-Context Encoder Modeling for {A}rabic",
author = "Elshehy, Omar and
Nacar, Omer and
Djamai, Abdelbasset and
Ragab, Muhammed and
AL Jallad, Khloud and
Abdelazim, Mona",
editor = "El-Haj, Mo and
Rayson, Paul and
Jarrar, Mustafa and
Ezeani, Ignatius and
Ezzini, Saad and
Ahmadi, Sina and
Haddad Haddad, Amal and
Amol, Cynthia and
Abdelali, Ahmad and
Abudalfa, Shadi",
booktitle = "Proceedings of the 2nd Workshop on {NLP} for Languages Using {A}rabic Script",
month = mar,
year = "2026",
address = "Rabat, Morocco",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.abjadnlp-1.39/",
doi = "10.18653/v1/2026.abjadnlp-1.39",
pages = "313--321",
}@misc{modernbert,
title={Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference},
author={Benjamin Warner and Antoine Chaffin and Benjamin Clavié and Orion Weller and Oskar Hallström and Said Taghadouini and Alexis Gallagher and Raja Biswas and Faisal Ladhak and Tom Aarsen and Nathan Cooper and Griffin Adams and Jeremy Howard and Iacopo Poli},
year={2024},
eprint={2412.13663},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.13663},
}@inproceedings{remy-delobelle2024transtokenization,
title={Trans-Tokenization and Cross-lingual Vocabulary Transfers: Language Adaptation of {LLM}s for Low-Resource {NLP}},
author={Remy, Fran{\c{c}}ois and Delobelle, Pieter and Avetisyan, Hayastan and Khabibullina, Alfiya and de Lhoneux, Miryam and Demeester, Thomas},
booktitle={First Conference on Language Modeling},
year={2024},
url={https://openreview.net/forum?id=sBxvoDhvao}
}