Downloads · 30 days
14
25% of all-time downloads
johnlockejrr/marianmt_heb_voc
marianmt_heb_voc is a translation model from johnlockejrr. Use it when you need text moved from one language to another. The card lists the license as apache-2.0.
A fine-tuned MarianMT model for automatic Biblical Hebrew vocalization, converting consonantal (unvocalized) Biblical Hebrew text to fully vocalized text with niqqud (vowel marks).
Downloads · 30 days
14
25% of all-time downloads
All-time downloads
56
Public
Parameters
61.4M
247 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors246 MB · 99%
From the Hugging Face model README
A fine-tuned MarianMT model for automatic Biblical Hebrew vocalization, converting consonantal (unvocalized) Biblical Hebrew text to fully vocalized text with niqqud (vowel marks).
This model is fine-tuned from Helsinki-NLP/opus-mt-sem-sem to perform Biblical Hebrew vocalization—the task of adding niqqud (vowel signs) to consonantal Biblical Hebrew text. The model is trained in a single direction: consonantal → vocalized.
>>heb_cons<<) to vocalized Biblical Hebrew (>>heb_voc<<)>>heb<< tokenizationHelsinki-NLP/opus-mt-sem-sem>>heb_cons<< (consonantal Biblical Hebrew)>>heb_voc<< (vocalized Biblical Hebrew)book|chapter|verse|content where content contains vocalized Biblical Hebrewfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("johnlockejrr/marianmt_heb_voc")
model = AutoModelForSeq2SeqLM.from_pretrained("johnlockejrr/marianmt_heb_voc")
# Input: consonantal Biblical Hebrew text
text = "בראשית ברא אלהים את השמים ואת הארץ"
# Add language tag
input_text = f">>heb_cons<< {text}"
# Tokenize
inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True, max_length=384)
# Generate
outputs = model.generate(**inputs, max_length=384, num_beams=4, length_penalty=0.6)
# Decode
vocalized = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(vocalized)
from transformers import pipeline
vocalizer = pipeline("text2text-generation",
model="johnlockejrr/marianmt_heb_voc",
tokenizer="johnlockejrr/marianmt_heb_voc")
# Input text (consonantal)
text = "בראשית ברא אלהים את השמים ואת הארץ"
input_text = f">>heb_cons<< {text}"
# Vocalize
result = vocalizer(input_text, max_length=384, num_beams=4, length_penalty=0.6)
print(result[0]['generated_text'])
The model expects input text to be normalized to NFC (Normalization Form Composed) Unicode format. The model automatically handles this, but for best results, ensure your input text is properly normalized:
import unicodedata
def normalize_text(text: str) -> str:
"""Normalize text to NFC format."""
return unicodedata.normalize("NFC", text)
# Normalize input before processing
text = normalize_text("בראשית ברא אלהים")
For optimal results, input text should contain only consonantal Biblical Hebrew characters. The model automatically:
Recommended generation parameters:
>>heb_cons<< and >>heb_voc<<) added to tokenizer vocabulary{
"learning_rate": 1e-5,
"batch_size": 8,
"gradient_accumulation_steps": 4,
"num_epochs": 100,
"max_input_length": 384,
"max_target_length": 384,
"warmup_steps": 1000,
"weight_decay": 0.01,
"eval_steps": 1000,
"save_steps": 1000,
"save_total_limit": 3
}
The model is evaluated using three metrics:
| Metric | Validation (Best) | Test (Final) |
|---|---|---|
| BLEU | 51.95 | 50.74 |
| chrF | 86.95 | 86.31 |
| Char Acc | 68.22% | 68.89% |
| Loss | 0.1393 | 0.1430 |
If you use this model, please cite:
@misc{marianmt_heb_voc,
title={MarianMT Biblical Hebrew Vocalization Model},
author={johnlockejrr},
year={2025},
howpublished={\url{https://huggingface.co/johnlockejrr/marianmt_heb_voc}},
note={Fine-tuned from Helsinki-NLP/opus-mt-sem-sem}
}
For questions, issues, or contributions, please open an issue on the model repository.
This model is released under the Apache 2.0 license, consistent with the base model.