hmar-heritage-org/sentences
Viewer • Updated • 266k • 205 • 2
HmarBERT-mini-causal is an autoregressively aligned causal language model derived from azinamotoe/HmarBERT-mini (16.91M parameters), trained for the Hmar language (hmr, ISO 639-3).
While HmarBERT-mini uses bidirectional attention for masked token reconstruction, HmarBERT-mini-causal enforces a causal (lower-triangular) attention mask (is_decoder=True). It is aligned specifically for ultra-fast next-word prediction, designed to power:
is_decoder=True, causal attention masking)The base model azinamotoe/HmarBERT-mini completed 48 epochs of bidirectional pretraining (24 epochs on sentences + 24 epochs on paragraphs).
In HmarBERT-mini-causal, the pre-trained weights are adapted into a causal decoder:
hmar-heritage-org/sentences.import torch
from transformers import BertTokenizerFast, BertLMHeadModel
MODEL_ID = "azinamotoe/HmarBERT-mini-causal"
tokenizer = BertTokenizerFast.from_pretrained(MODEL_ID)
model = BertLMHeadModel.from_pretrained(MODEL_ID)
model.eval()
def predict_next_words(text: str, top_k: int = 3):
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits[0, -1, :]
probs = torch.softmax(logits, dim=-1)
top_probs, top_indices = torch.topk(probs, k=top_k)
return [
(tokenizer.decode([idx.item()]).strip(), f"{prob.item() * 100:.1f}%")
for prob, idx in zip(top_probs, top_indices)
]
# Example predictions
print(predict_next_words("Ka lawm", top_k=3))
print(predict_next_words("Invaithai", top_k=3))
Maintained by the Hmar Heritage Foundation and Azinamotoe.
hmar-heritage-orgazinamotoe/HmarBERT-miniBase model
azinamotoe/HmarBERT-mini