rudrashah/RLM-hinglish-translator-bidir-2
146
Hinglish ↔ English Bidirectional Translator
<p align="center"> <a href="https://www.buymeacoffee.com/rudrashah" target="_blank"> <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;"> </a> </p>
RLM-hinglish-translator-bidir-2 is a fully bidirectional Hinglish ↔ English translation model — the first in this series to support translation in both directions. Built on the same 4B instruction-tuned base as v2 and fine-tuned using PEFT (LoRA) with TRL's SFTTrainer, it lets you seamlessly convert between informal Hinglish and English without needing two separate models.
What's New
- Bidirectional translation — Translate from Hinglish → English and English → Hinglish in a single model.
- Direction-aware prompting — The model uses explicit instruction prompts to distinguish translation direction at inference time.
- Same strong base — Retains the 4B instruction-tuned backbone from v2 for high fluency and contextual understanding.
- Expanded training — Fine-tuned on both directions of the
findnitai/english-to-hinglishdataset for balanced performance.
Usage
Hinglish → English
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "rudrashah/RLM-hinglish-translator-bidir-2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [
{
"role": "user",
"content": "Hinglish:\naapka name kya hai?"
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=128,
use_cache=True,
temperature=1.0,
top_p=0.95,
top_k=64,
)
print(tokenizer.batch_decode(outputs))English → Hinglish
messages = [
{
"role": "user",
"content": "English:\nWhat are you doing tomorrow?"
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=128,
use_cache=True,
temperature=1.0,
top_p=0.95,
top_k=64,
)
print(tokenizer.batch_decode(outputs))Note: Always include the Language of Input for Best Result.
Examples
Hinglish → English
English → Hinglish
Limitations
- Best suited for short to medium-length informal sentences, similar to everyday chat messages.
- May struggle with heavy regional slang, very long sentences, or dialect-specific expressions.
- English → Hinglish outputs reflect the Hinglish style present in the training data and may not match all regional variations.
Model History
Thanks to that one girl who motivated me. Thank you P.
