Gemma3-12b-Indic / README.md
bharathkumar1922001's picture
Update README.md
4e28394 verified
metadata
language: te
license: apache-2.0
library_name: transformers
tags:
  - gemma
  - gemma3
  - telugu
  - llm
  - fine-tuned
  - sft
  - modal
  - llama-factory
  - text-generation
  - conversational
datasets:
  - custom-telugu-qa
model_name: Gemma-3-12B-Telugu-SFT
base_model: google/gemma-3-12b-pt
pipeline_tag: text-generation

🌟 Gemma-3-12B Indic 🌟

Get ready! This isn't just any language model; it's Google's Gemma-3-12B, supercharged with full Supervised Fine-Tuning (SFT) specifically for Indic languages, starting with Telugu! Trained on a custom dataset packed with Telugu questions and answers, this model is designed to understand, converse, and generate text like a native speaker.

We're working our way through all major Indic languages to create a comprehensive multilingual Indic assistant.

Indic Language Support Roadmap

Language Status ISO Code
Telugu (తెలుగు) ✅ Completed te
Hindi (हिंदी) 🔄 Coming soon hi
Tamil (தமிழ்) 🔄 Coming soon ta
Malayalam (മലയാളം) 🔄 Coming soon ml
Kannada (ಕನ್ನಡ) 🔄 Coming soon kn
Bengali (বাংলা) 🔄 Coming soon bn
Marathi (मराठी) 🔄 Coming soon mr
Punjabi (ਪੰਜਾਬੀ) 🔄 Coming soon pa
Gujarati (ગુજરાતી) 🔄 Coming soon gu
Odia (ଓଡ଼ିଆ) 🔄 Coming soon or
Assamese (অসমীয়া) 🔄 Coming soon as

✨ Sample Interaction ✨

Curious about what it can do? Here's a sneak peek:

User ( ప్రశ్న ): ఇండియాలో గ్రోసరీస్ మీద డబ్బులు సేవ్ చేయడానికి బెస్ట్ వేస్ ఏంటి? (What are the best ways to save money on groceries in India?)

Model ( జవాబు ): ఇండియాలో కిరాణా సామాన్ల మీద డబ్బులు సేవ్ చేయడానికి కొన్ని బెస్ట్ వేస్ ఇక్కడ ఉన్నాయి, చూడు:

  1. బడ్జెట్ పెట్టుకో: ఫస్ట్ థింగ్ ఫస్ట్, కిరాణా షాపింగ్ కి ఒక ఫిక్స్‌డ్ బడ్జెట్ పెట్టుకో. నెలకి ఎంత ఖర్చు పెట్టాలో ముందుగానే డిసైడ్ అయితే, ఎక్కువ ఖర్చు పెట్టకుండా ఉండొచ్చు.
  2. ప్లాన్ ప్రకారం షాపింగ్: షాపింగ్ కి వెళ్ళేముందు ఏం కొనాలి, ఎంత కొనాలి అని ఒక లిస్ట్ ప్రిపేర్ చేసుకో. లిస్ట్ లేకుండా వెళ్తే, అన్నీ కొనేస్తాం, బడ్జెట్ కూడా దాటిపోతుంది.
  3. డిస్కౌంట్స్ వెతుకు: సూపర్ మార్కెట్స్ లో డిస్కౌంట్స్, ఆఫర్స్ చాలా ఉంటాయి. వాటిని గమనిస్తూ ఉండు. కొన్నిసార్లు బండిల్ డీల్స్ కూడా ఉంటాయి, అవి చూస్తే మంచి సేవింగ్స్ ఉంటాయి.
  4. బల్క్ లో కొనడం బెటర్: కొన్ని ఐటమ్స్ ని బల్క్ లో కొంటే రేట్ తక్కువ వస్తుంది. ముఖ్యంగా పప్పులు, నూనెలు, పప్పులు లాంటివి ఎక్కువ రోజులు నిల్వ ఉంటాయి కాబట్టి బల్క్ లో కొనొచ్చు.
  5. సీజనల్ గా కొనడం స్మార్ట్: ఏ సీజన్ లో ఏది తక్కువ రేటుకి దొరుకుతుందో చూసుకొని కొనడం చాలా ముఖ్యం. సమ్మర్ లో పండ్లు, వింటర్ లో వెజిటేబుల్స్ తక్కువ రేటుకి వస్తాయి. వాటిని యూస్ చేసుకో.

🚀 Model & Training Details

This model didn't train itself! Here's the behind-the-scenes scoop:

  • Base Model: google/gemma-3-12b-pt
  • Fine-tuning Method: Full SFT (Supervised Fine-Tuning)
  • Current Language: Telugu (te) - First in our Indic series
  • Hardware: 🔥 8 x NVIDIA H100 GPUs 🔥 (Powered by Modal)
  • Training Time: Approx. 3 hours (9744 seconds)
  • Dataset: Custom Telugu QA dataset (40k samples)
  • Validation Split: 10% (36k train / 4k validation)
  • Frameworks: LLaMA Factory, transformers, accelerate, DeepSpeed (ZeRO Stage 2 w/ CPU Offload)
  • Precision: BF16

Key Hyperparameters:

  • Batch Size (Per Device): 2
  • Gradient Accumulation: 32 (Effective Batch Size: 512)
  • Learning Rate: 2e-5 (Cosine Scheduler)
  • Epochs Trained: ~2.97
  • Max Sequence Length: 4096

Training Metrics:

  • Final Train Loss: 0.7232
  • Train Samples/Second: 11.083
  • Total FLOPs: ~7.88e18 (That's a lot of math! 🤓)

🔮 Coming Soon

Exciting developments on the horizon:

  1. Indic TTS (Text-to-Speech) - We're developing a companion TTS model that will bring these responses to life with natural-sounding Indic language speech synthesis!

  2. Hindi-first LLM - We're working on a specialized fine-tuning track with Hindi as the primary language, while still maintaining multilingual Indic capabilities.

  3. More Indic languages - We're methodically working through all major Indic languages to create the most comprehensive Indic language assistant available.

Usage

Get started with the model using the transformers library:

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# Load model and tokenizer
model_name = "bharathkumar1922001/Gemma3-12b-Indic"
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Recommend using eager attention based on stability testing
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16, # Match training precision
    device_map="auto",          # Loads across available GPUs/CPU
    attn_implementation="eager" # Recommended for Gemma 3 stability
)
model.eval() # Set to evaluation mode for inference

# Format your prompt using the model's template
question = "ఆర్థిక మాంద్యాన్ని ప్రభుత్వాలు ఎలా పరిష్కరించగలవు?" # Example: How can governments solve economic recession?
prompt = f"<start_of_turn>user\n{question}<end_of_turn>\n<start_of_turn>model\n"

# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
    **inputs,
    max_new_tokens=512, # Adjust max length as needed
    temperature=0.7,    # Controls randomness (lower = more deterministic)
    top_p=0.95,         # Nucleus sampling probability
    top_k=50,           # Top-k sampling
    do_sample=True,     # Enable sampling based strategies
    eos_token_id=tokenizer.eos_token_id # Or specific ID like tokenizer.convert_tokens_to_ids("<end_of_turn>")[0]
)

# Decode the response (excluding the input prompt)
response_ids = outputs[0, inputs.input_ids.shape[1]:]
response = tokenizer.decode(response_ids, skip_special_tokens=True)

print("--- Question ---")
print(question)
print("\n--- Response ---")
print(response)

Contact

For collaborations, custom deployments, or any queries regarding this model, please reach out to us.