Downloads · 30 days
15
3% of all-time downloads
frankmorales2020/akkadian-to-english-translator
akkadian-to-english-translator is a machine learning model from frankmorales2020. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
ARTICLE: https://medium.com/@frankmorales91352/akkadian-to-english-building-a-neural-bridge-to-the-ancient-world-dd7bacbb9a02
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
453
Public
Parameters
611M
9.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 99%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
import torch
from transformers import MBart50TokenizerFast, MBartForConditionalGeneration
# 1. SETUP
repo_id = "frankmorales2020/akkadian-to-english-translator"
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Loading updated model from {repo_id}...")
# Initialize with standard codes to prevent initialization errors
tokenizer = MBart50TokenizerFast.from_pretrained(repo_id, src_lang="en_XX", tgt_lang="en_XX")
model = MBartForConditionalGeneration.from_pretrained(repo_id).to(device)
# 2. REGISTER CUSTOM TOKEN
akk_token = "[akk_AK]"
if akk_token not in tokenizer.lang_code_to_id:
tokenizer.add_special_tokens({'additional_special_tokens': [akk_token]})
tokenizer.lang_code_to_id[akk_token] = tokenizer.convert_tokens_to_ids(akk_token)
# 3. TRANSLATION FUNCTION
def test_translate(text):
tokenizer.src_lang = akk_token
inputs = tokenizer(text, return_tensors="pt").to(device)
en_id = tokenizer.convert_tokens_to_ids("en_XX")
with torch.no_grad():
generated_tokens = model.generate(
**inputs,
forced_bos_token_id=en_id,
max_new_tokens=60,
num_beams=5
)
return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
# 4. COMPREHENSIVE TEST SUITE
# Testing legal, astronomical, and environmental categories
new_test_data = {
"Legal Formulas": [
"šumma wardum bēlšu ittabal",
"šumma tamkārum kaspam iddin",
"šumma šarrum mēšaram ištakan"
],
"Astronomical Observations": [
"Sin u Šamaš itti ahāmeš innamrū",
"bibbu ina libbi Zuqaqīpī ittiqi",
"kakkab ra-bi-i ittanmar"
],
"Environmental/Historical": [
"Idiglat u Purattu mīla imlū",
"ina rēš šattim rādu ištakan",
"šubtu nēhtu ina māti ibašši"
]
}
print("\n" + "="*60)
print("EXPANDED AKKADIAN-TO-ENGLISH TEST RESULTS")
print("="*60)
for category, phrases in new_test_data.items():
print(f"\n>>> CATEGORY: {category}")
print("-" * 30)
for phrase in phrases:
result = test_translate(phrase)
print(f"AK: {phrase}")
print(f"EN: {result}\n")
Loading updated model from frankmorales2020/akkadian-to-english-translator...
============================================================
EXPANDED AKKADIAN-TO-ENGLISH TEST RESULTS
============================================================
>>> CATEGORY: Legal Formulas
------------------------------
AK: šumma wardum bēlšu ittabal
EN: if a slave strikes his master
AK: šumma tamkārum kaspam iddin
EN: if a merchant has given silver
AK: šumma šarrum mēšaram ištakan
EN: if the king has established justice
>>> CATEGORY: Astronomical Observations
------------------------------
AK: Sin u Šamaš itti ahāmeš innamrū
EN: the Moon and Sun were seen together
AK: bibbu ina libbi Zuqaqīpī ittiqi
EN: a planet passed through the heart of Scorpio
AK: kakkab ra-bi-i ittanmar
EN: a great star was seen
>>> CATEGORY: Environmental/Historical
------------------------------
AK: Idiglat u Purattu mīla imlū
EN: the Tigris and Euphrates were filled with the flood
AK: ina rēš šattim rādu ištakan
EN: at the beginning of the year a rainstorm occurred
AK: šubtu nēhtu ina māti ibašši
EN: there is a peaceful dwelling in the land
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]