Instructions to use Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa
- SGLang
How to use Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa with Docker Model Runner:
docker model run hf.co/Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa
Use Docker images
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa" \
--host 0.0.0.0 \
--port 30000# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'Indic-gemma-7b-finetuned-sft-Navarasa
This model is based on google/gemma-7b and hase been LoRA finetuned on 9 Indian languages and English language instruction datasets:
Hindi - ravithejads/samvaad-hi-filtered, HydraIndicLM/hindi_alpaca_dolly_67k(sampled)
Telugu - Telugu-LLM-Labs/yahma_alpaca_cleaned_telugu_filtered_and_romanized, Telugu-LLM-Labs/teknium_GPTeacher_general_instruct_telugu_filtered_and_romanized
Tamil - abhinand/tamil-alpaca
Kannada - Tensoic/airoboros-3.2_kn, Tensoic/gpt-teacher_kn
Malayalam - VishnuPJ/Alpaca_Instruct_Malayalam
Gujarati - Tensoic/Alpaca-Gujarati
Punjabi - HydraIndicLM/punjabi_alpaca_52K
Bengali - HydraIndicLM/bengali_alpaca_dolly_67k(alpaca filtered)
Odia - OdiaGenAI/Odia_Alpaca_instructions_52k, OdiaGenAI/gpt-teacher-roleplay-odia-3k
English - yahma/alpaca-cleaned
The model is finetuned using unsloth library and we provide inference code using the same for faster inference. Alternatively you can use HuggingFace Library for inference.
Training Details:
The model is trained on approx 500K instruction samples.
- GPU: 1 A100, 80GB
- Time: 36.5 Hours
- Platform: E2E Networks
Installation
!pip install "unsloth[colab-ampere] @git+https://github.com/unslothai/unsloth.git"
Input Text Format
### Instruction: {instruction}
### Input: {input}
## Response: {response}
Inference With Unsloth
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = False
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
device_map="auto"
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
input_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
input_text = input_prompt.format(
"Tranlsate following sentence to Hindi.", # instruction
"This model is developed by Telugu LLM Labs", # input
"", # output - leave this blank for generation!
)
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
response = tokenizer.batch_decode(outputs)
Inference with HuggingFace
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
model = AutoPeftModelForCausalLM.from_pretrained(
"Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa",
load_in_4bit = False,
token = hf_token
)
tokenizer = AutoTokenizer.from_pretrained("Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa")
input_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
input_text = input_prompt.format(
"Tranlsate following sentence to Hindi.", # instruction
"This model is developed by Telugu LLM Labs", # input
"", # output - leave this blank for generation!
)
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
response = tokenizer.batch_decode(outputs)[0]
Refer to the blog post for sample examples.
Please check our Code Repository for training and inference scripts.
Developers:
The model is a collaborative effort by Ravi Theja and Ramsri Goutham. Feel free to DM either of us if you have any questions.
Model tree for Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa
Base model
google/gemma-7b
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa" \ --host 0.0.0.0 \ --port 30000# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'