Downloads · 30 days
12
2% of all-time downloads
keenanpepper/one-way-polyglot-8m-tied
one-way-polyglot-8m-tied is a text generation model from keenanpepper. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A one-way polyglot language model trained to understand Japanese but generate only English.
Downloads · 30 days
12
2% of all-time downloads
All-time downloads
797
Public
Parameters
8.5M
68.8 MB on disk
Likes
0
Public
Click a slice to open those files.
.bin34.1 MB · 49%
From the Hugging Face model README
A one-way polyglot language model trained to understand Japanese but generate only English.
Trained on bilingual Japanese-English story data with masked loss on Japanese prefixes to enforce one-way generation.
from transformers import LlamaForCausalLM, AutoTokenizer
model = LlamaForCausalLM.from_pretrained("one-way-polyglot-8m-tied")
tokenizer = AutoTokenizer.from_pretrained("one-way-polyglot-8m-tied")
# Japanese input → English output (primary use case)
prompt = "昔々、赤い傘を持った少女がいました。"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# Mixed-language name transliteration
prompt = "太郎は公園で花子と遊んでいました。After playing, Taro told Hanako that"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=30, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# English text (works perfectly with case folding)
prompt = "Hello World" # Automatically normalized to lowercase
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=30, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This is part of a series exploring one-way polyglot capabilities:
Apache 2.0