Instructions to use CoRover/BharatGPT-mini-Indic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CoRover/BharatGPT-mini-Indic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CoRover/BharatGPT-mini-Indic") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CoRover/BharatGPT-mini-Indic") model = AutoModelForCausalLM.from_pretrained("CoRover/BharatGPT-mini-Indic") messages = [ {"role": "user", "content": "Who are you?"}, ] 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CoRover/BharatGPT-mini-Indic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CoRover/BharatGPT-mini-Indic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CoRover/BharatGPT-mini-Indic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CoRover/BharatGPT-mini-Indic
- SGLang
How to use CoRover/BharatGPT-mini-Indic 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 "CoRover/BharatGPT-mini-Indic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CoRover/BharatGPT-mini-Indic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "CoRover/BharatGPT-mini-Indic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CoRover/BharatGPT-mini-Indic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CoRover/BharatGPT-mini-Indic with Docker Model Runner:
docker model run hf.co/CoRover/BharatGPT-mini-Indic
Model Description
BharatGPT-mini-indic is a fine-tuned version of BharatGPT-mini developed to enhance multilingual understanding and text generation for Indic languages. Built on a Transformer-based autoregressive architecture, the base model was pretrained on large-scale public text corpora using a self-supervised causal language modeling approach, enabling it to learn grammar, semantics, and contextual relationships across languages.
BharatGPT-mini-indic is further fine-tuned on Indic-language datasets to improve performance in regional language understanding, multilingual conversation, and natural language generation tasks. The model is well suited for applications such as conversational AI, question answering, summarization, intent detection, entity extraction, and multilingual virtual assistants, with a strong focus on Indian language use cases.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# -----------------------------------
# LOAD MODEL
# -----------------------------------
model_name = "CoRover/BharatGPT-mini-Indic"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
model.eval()
# -----------------------------------
# SETTINGS
# -----------------------------------
FALLBACK_MESSAGE = "Sorry, I don't know the answer to that."
# Only block obvious garbage phrases
BAD_PHRASES = [
"digital commerce solutions",
"business operations effectively",
"real-time data sources",
"verification and privacy",
"affordable price point",
"ensuring that your ai",
"platform based on ai technology",
]
print("Chat started (type 'exit' to quit)\n")
# -----------------------------------
# VALIDATION FUNCTION
# -----------------------------------
def is_invalid_response(question, response):
q = question.lower().strip()
r = response.lower().strip()
# -----------------------------------
# EMPTY RESPONSE
# -----------------------------------
if len(r) < 3:
return True
# -----------------------------------
# IDENTITY / ENTITY QUESTIONS
# -----------------------------------
identity_patterns = [
"who is",
"what is",
"tell me about",
"who made",
"who built",
"who created",
"what are",
]
is_identity_question = any(
pattern in q for pattern in identity_patterns
)
# -----------------------------------
# ALLOW RELEVANT ENTITY ANSWERS
# -----------------------------------
if is_identity_question:
important_words = [
word for word in q.split()
if len(word) > 2
]
for word in important_words:
if word in r:
return False
# -----------------------------------
# BAD PHRASES
# -----------------------------------
for phrase in BAD_PHRASES:
if phrase in r:
return True
# -----------------------------------
# TOO LONG
# -----------------------------------
if len(r.split()) > 40:
return True
# -----------------------------------
# TOO REPETITIVE
# -----------------------------------
words = r.split()
if len(words) > 10:
unique_ratio = len(set(words)) / len(words)
if unique_ratio < 0.5:
return True
# -----------------------------------
# BAD ENDINGS
# -----------------------------------
bad_endings = [
"and",
"or",
"but",
"because",
"so",
]
for ending in bad_endings:
if r.endswith(ending):
return True
# -----------------------------------
# TOO MANY SYMBOLS
# -----------------------------------
if response.count(":") > 3:
return True
# -----------------------------------
# GENERAL RELEVANCE CHECK
# -----------------------------------
question_words = set(q.split())
response_words = set(r.split())
overlap = question_words.intersection(response_words)
if len(overlap) == 0 and len(words) > 12:
return True
return False
# -----------------------------------
# CHAT LOOP
# -----------------------------------
while True:
user_input = input("You: ")
if user_input.lower() in ["exit", "quit"]:
break
# -----------------------------------
# PROMPT
# -----------------------------------
prompt = f"""
You are a helpful AI assistant.
Rules:
- Give short factual answers.
- Do not generate advertisements.
- Do not invent fake information.
- If unsure, reply only:
"I don't know."
User: {user_input}
Assistant:
"""
# -----------------------------------
# TOKENIZE
# -----------------------------------
inputs = tokenizer(
prompt,
return_tensors="pt"
).to(device)
# -----------------------------------
# GENERATE
# -----------------------------------
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=35,
temperature=0.5,
top_p=0.85,
top_k=40,
do_sample=True,
repetition_penalty=1.2,
no_repeat_ngram_size=3,
pad_token_id=tokenizer.eos_token_id
)
# -----------------------------------
# DECODE
# -----------------------------------
decoded = tokenizer.decode(
outputs[0],
skip_special_tokens=True
)
response = decoded[len(prompt):].strip()
# Remove extra generated turns
response = response.split("User:")[0].strip()
# -----------------------------------
# VALIDATE RESPONSE
# -----------------------------------
if is_invalid_response(user_input, response):
response = FALLBACK_MESSAGE
# -----------------------------------
# PRINT RESPONSE
# -----------------------------------
print(f"Bot: {response}\n")
It is best suited for S-RAG (Secure Retrieval-Augmented Generation) or fine-tuning with your own data. For enhanced performance, integration with Conversational Agentic AI platform is recommended (though not mandatory). This platform enables the creation of multi-modal and multi-lingual AI Agents, Co-Pilots, and Virtual Assistants (such as ChatBots, VoiceBots, and VideoBots) using a sovereign AI and composite AI approach. It leverages classic NLP, grounded generative AI with BharatGPT, and Generally Available LLMs to deliver powerful, versatile AI solutions.
Usage and Limitations
License: Non-Commercial. For academic and research purposes only. For commercial use, please visit Conversational Gen AI platform or Contact Us.
Terms of Use: Terms and Conditions
Responsible AI Framework: CoRover's Responsible AI Framework
Developed by: CoRover.ai
- Downloads last month
- -