1from transformers import pipeline
2
3fill_mask = pipeline("fill-mask", model="mabahboh/ShamiBERT")
4
5# Shami examples
6results = fill_mask("كيفك [MASK] الحمدلله")
7for r in results[:3]:
8 print(f"{r['token_str']} ({r['score']:.4f})")
1from transformers import AutoTokenizer, AutoModel
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("mabahboh/ShamiBERT")
5model = AutoModel.from_pretrained("mabahboh/ShamiBERT")
6
7text = "شو أخبارك يا زلمة"
8inputs = tokenizer(text, return_tensors="pt")
9outputs = model(**inputs)
10
11# Use [CLS] token embedding for classification
12cls_embedding = outputs.last_hidden_state[:, 0, :]
1from arabert.preprocess import ArabertPreprocessor
2
3prep = ArabertPreprocessor(model_name="bert-base-arabertv02-twitter", keep_emojis=True)
4text = prep.preprocess("كيفك يا خيي")
1@misc{shamibert2026,
2 title={ShamiBERT: A BERT Model for Levantine Arabic Dialect},
3 year={2026},
4 note={Continual pre-training of AraBERT-Twitter on Levantine Arabic data}
5}