Qwen2.5-7B English-Kannada Translation Model

A fine-tuned translation model based on Qwen2.5-7B-Instruct, specialized for translating between English and Kannada (เฒ•เฒจเณเฒจเฒก).

Model Description

This model is a fine-tuned version of Qwen/Qwen2.5-7B-Instruct trained on English-Kannada translation pairs. Kannada is a Dravidian language spoken primarily in the Indian state of Karnataka.

Training was done across 4xNVIDIA A100-SXM4-40GB GPUs for 6h 48m 10s using 64,603,656 tokens. Training frameworks used were transformers, peft, trl and accelerate for distributed setup.

How to Use

Basic Usage

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("RakshithFury/Qwen2.5-7b-en-kn-translate")
model = AutoModelForCausalLM.from_pretrained("RakshithFury/Qwen2.5-7b-en-kn-translate")

model = model.to("cuda:0")

sentences = [sentence1, sentence2,....]

for sentence in sentences:
    messages = [
        {"role": "user", "content": "Translate the following English sentence to Kannada:" + sentence},
    ]

    inputs = tokenizer.apply_chat_template(messages,add_generation_prompt=True,tokenize=True,return_dict=True,return_tensors="pt").to(model.device)
    outputs = model.generate(**inputs, max_new_tokens=200,temperature=0.5,min_p=0.1)
    res = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:],skip_special_tokens=True)

    print(res)

Training Details

Training Data

Trained on 500000 samples of english-kannada translation pairs.

Training Procedure

  • Framework - transformers, trl
  • Distributed training - Yes, using DDP through accelerate
  • LoRA - Yes

Training Hyperparameters

  • Batch size: per_device_batch_size=4, gradient_accumulation=1,num_gpus=4 i.e effective batch size of 16
  • Epochs: 1
  • Optimizer: AdamW
  • Learning rate: 2e-4
  • LoRA rank: 8
  • LoRA alpha: 16

Train curves

The train loss is 0.5036 and the token accuracy is 87%.

Eval Data

Eval curves

It is clear that the eval loss hasn't saturated. There is still scope for it's decrease.

Hardware

  • GPU: 4x NVIDIA A100-SXM4
  • CPU count 128
  • Logical CPU count 256

Example Translations

Example 1

English sentence:
What is the meaning of life?

Default model:
็”Ÿๅ‘ฝๅ‘จๆœŸ เฒจเณ€เฒกเฒฒเณ เฒŽเฒ‚เฒฆเณ เฒคเณ†เฒฐเณ†เฒฏเฒฟเฒฐเฒฟ?

Finetuned model:
เฒœเณ€เฒตเฒจเฒฆ เฒ…เฒฐเณเฒฅ เฒเฒจเณ?


Example 2

English sentence:
My biggest problem is deciding what I should wear.

Default model:
เฒจ เฒนเณŠเฒธ เฒธเฒฎเฒธเณเฒฏเณ†เฒฏเณ เฒจเฒจเณเฒจ เฒตเณˆเฒฐเฒพเฒ—เณเฒฏเฒตเฒจเณเฒจเณ เฒคเฒฟเฒณเฒฟเฒฆเณ‡เฒ•เณเฒ•เฒพเฒ—เฒฟ เฒŽเฒ‚เฒฌ เฒตเณˆเฒธเณ€เฒจเฒฟเฒฏเฒจเณเฒจเณ เฒ’เฒกเณเฒกเณเฒตเณเฒฆเณ.

Finetuned model:
เฒจเฒพเฒจเณ เฒเฒจเณ เฒงเฒฐเฒฟเฒธเฒฌเณ‡เฒ•เณ†เฒ‚เฒฆเณ เฒจเฒฟเฒฐเณเฒงเฒฐเฒฟเฒธเณเฒตเณเฒฆเณ เฒจเฒจเฒ—เณ† เฒ…เฒคเฒฟ เฒฆเณŠเฒกเณเฒก เฒธเฒฎเฒธเณเฒฏเณ†.


Example 3

English sentence:
It was probably the first thing I remembered from my early childhood.

Default model:
เฒฏเฒพเฒตเณเฒฆเณ‡ เฒˆเฒ— เฒนเฒฒเฒตเฒพเฒฐเณ เฒตเฒฐเณเฒทเฒ—เฒณ เฒ•เณเฒ•เณ† เฒชเณเฒฐเณŠเฒœเณ†เฒ•เณเฒŸเณโ€Œเฒจเฒฒเณเฒฒเฒฟ เฒฎเฒจเณ†เฒฏเฒฒเณเฒฒเฒฟ เฒฌเฒฐเณเฒคเณเฒคเฒฟเฒฐเณเฒต เฒฎเณเฒ–เณเฒฏ เฒšเฒฟเฒคเณเฒฐเฒ—เฒณเณ เฒจเฒ‚เฒคเฒฐ เฒฎเณเฒ‚เฒฆเณ† เฒนเณ†เฒšเณเฒšเณ เฒตเฒฐเณเฒทเฒ—เฒณ เฒ•เณเฒ•เณ† เฒธเณ†เฒŸเณโ€Œเฒชเฒกเฒฟเฒธเฒฒเฒพเฒ—เฒฟเฒฆเณ†.

Finetuned model:
เฒฌเณ†เฒณเณ†เฒฆ เฒฎเณŠเฒฆเฒฒ เฒตเฒฐเณเฒทเฒฆเฒฒเณเฒฒเฒฟ เฒจเฒจเฒ—เณ† เฒธเฒ‚เฒญเฒตเฒจเณ€เฒฏเฒตเฒพเฒ—เฒฟ เฒฎเฒฐเณ†เฒฏเฒฒเฒพเฒ—เฒฆ เฒ’เฒ‚เฒฆเณ เฒ˜เฒŸเฒจเณ†.


Example 4

English sentence:
Captain America is my favorite Avenger

Default model:
เฒ•เคชเฅเคŸเคจ เฒ…เฒฎเณ†เฒฐเฒฟเฒ•เฒพ เฒŽเฒ‚เฒฆเฒฐเณ† เฒจเฒจเณเฒจ เฒชเณเฒฐเฒฏเฒคเณเฒจเฒฟเฒค เฒเฒตเณโ€Œเฒจเณ‡เฒ‚เฒŸเฒฟเฒจ เฒธเณŠเฒจเณเฒจเณ‹เฒคเณเฒคเฒฎ เฒตเฒฟเฒทเฒฏเฒตเฒพเฒ—เฒฟเฒฆเณ†.

Finetuned model:
เฒจเฒพเฒจเณ เฒจเฒฟเฒฐเณเฒฆเณ‡เฒถเฒ• เฒ…เฒตเฒฐ เฒชเณเฒฐเฒฟเฒฏ เฒธเณเฒŸเฒพเฒฐเณ เฒ†เฒ—เฒฟเฒฆเณเฒฆเณ‡เฒจเณ† เฒ•เณเฒฏเฒพเฒชเณเฒŸเฒจเณ เฒ…เฒฎเณ†เฒฐเฒฟเฒ•เฒพ.


CO2 Emission Related to Experiments

Experiments were conducted using a private infrastructure, which has a carbon efficiency of 0.432kgCO2/kWh.

Total emissions are estimated to be 0.76 kgCO2 Which is equivalent to

  • 3.07km driven by an average ICE car
  • 0.38 Kgs of coal burned
  • 0.01 Tree seedlings sequesting carbon for 10 years

Limitations and Bias

Known Limitations

  • The model may struggle with:
    • Complex sentences with strange words (eg avenger)
    • Very long sentences

Citation

If you use this model in your research, please cite:

@misc{RakshithFury/Qwen2.5-7b-en-kn-translate,
  author = {Rakshith Rao},
  title = {Qwen2.5-7B English-Kannada Translation Model},
  year = {2024},
  publisher = {HuggingFace},
  url = {https://huggingface.co/your-username/model-name}
}

Base Model Citation

@article{qwen2.5,
  title={Qwen2.5: A Party of Foundation Models},
  author={Qwen Team},
  year={2024},
  journal={arXiv preprint arXiv:2412.xxxxx}
}

Contact

For questions or feedback:

Downloads last month
13
Safetensors
Model size
8B params
Tensor type
F32
ยท
Inference Providers NEW
Input a message to start chatting with RakshithFury/Qwen2.5-7b-en-kn-translate.

Model tree for RakshithFury/Qwen2.5-7b-en-kn-translate

Base model

Qwen/Qwen2.5-7B
Finetuned
(3,262)
this model