Views
No views yet
1from transformers import AutoModelForMaskedLM, AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained('dicta-il/neodictabert-bilingual')
4model = AutoModelForMaskedLM.from_pretrained('dicta-il/neodictabert-bilingual', trust_remote_code=True)
5
6model.eval()
7
8sentence = 'בשנת 1948 השלים אפרים קישון את [MASK] בפיסול מתכת ובתולדות האמנות והחל לפרסם מאמרים הומוריסטיים'
9
10output = model(tokenizer.encode(sentence, return_tensors='pt'))
11# the [MASK] is the 7th token (including [CLS])
12import torch
13top_2 = torch.topk(output.logits[0, 7, :], 2)[1]
14print('\n'.join(tokenizer.convert_ids_to_tokens(top_2))) # should print לימודיו / הכשרתוNeoDictaBERT: Pushing the Frontier of BERT models for Hebrew1@misc{shmidman2025neodictabertpushingfrontierbert,
2 title={NeoDictaBERT: Pushing the Frontier of BERT models for Hebrew},
3 author={Shaltiel Shmidman and Avi Shmidman and Moshe Koppel},
4 year={2025},
5 eprint={2510.20386},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2510.20386},
9}