Downloads · 30 days
6
7% of all-time downloads
hina6198/urdu-roman-transliterator-lora
urdu-roman-transliterator-lora is a machine learning model from hina6198. 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 peft. The card lists the license as apache-2.0.
This model transliterates Urdu script text into Roman Urdu (Urdu written using Latin/English characters).
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
82
Public
Repo size
21.4 MB
Likes
0
Public
Click a slice to open those files.
.json21.4 MB · 100%
From the Hugging Face model README
This model transliterates Urdu script text into Roman Urdu (Urdu written using Latin/English characters).
This is a LoRA (Low-Rank Adaptation) fine-tuned adapter built on top of ogx786/urdu-roman-transliterator-tiny-aya. It was trained to convert Urdu-script sentences into their Roman Urdu equivalents using an instruction-style prompt format.
Use this model to convert Urdu script text into Roman Urdu, useful for:
Not intended for general-purpose text generation, translation into English, or use with languages other than Urdu.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_name = "ogx786/urdu-roman-transliterator-tiny-aya"
adapter_repo = "hina6198/urdu-roman-transliterator-lora" # update with your username
tokenizer = AutoTokenizer.from_pretrained(adapter_repo)
base_model = AutoModelForCausalLM.from_pretrained(base_model_name, device_map="auto")
model = PeftModel.from_pretrained(base_model, adapter_repo)
model.eval()
def transliterate(urdu_text):
prompt = f"""### Instruction:
Transliterate Urdu to Roman Urdu.
### Input:
{urdu_text}
### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100, do_sample=False)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
return result.split("### Response:")[-1].strip()
print(transliterate("تم کیسے ہو؟"))
[Describe your dataset here — size, source, e.g. "~X,000 Urdu–Roman Urdu sentence pairs collected/curated from ..."]
q_proj, v_proj, dropout=0.05