This model bridges the gap between global AI capabilities and local Indian needs, offering enhanced performance in:
1# Generate Hindi poetry or stories
2response = model.generate(
3 "हिंदी में एक सुंदर कविता लिखें होली के बारे में",
4 max_length=200
5)
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load the model and tokenizer
5model_name = "anktechsol/anki-2.5"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype=torch.float32,
10 device_map="auto"
11)
12
13# Generate text in Hindi
14prompt = "भारत में AI का भविष्य"
15inputs = tokenizer.encode(prompt, return_tensors="pt")
16
17with torch.no_grad():
18 outputs = model.generate(
19 inputs,
20 max_length=100,
21 temperature=0.7,
22 do_sample=True,
23 pad_token_id=tokenizer.eos_token_id
24 )
25
26response = tokenizer.decode(outputs[0], skip_special_tokens=True)
27print(response)
1# Multi-language conversation
2conversation = [
3 {"role": "user", "content": "मुझे अपने बिजनेस के लिए एक मार्केटिंग स्ट्रैटेजी चाहिए।"},
4]
5
6# Apply chat template
7formatted_prompt = tokenizer.apply_chat_template(
8 conversation,
9 tokenize=False,
10 add_generation_prompt=True
11)
12
13# Generate response
14inputs = tokenizer(formatted_prompt, return_tensors="pt")
15outputs = model.generate(**inputs, max_length=512, temperature=0.8)
16response = tokenizer.decode(outputs[0], skip_special_tokens=True)
1# Using with LangChain for Indian applications
2from langchain.llms.huggingface_pipeline import HuggingFacePipeline
3from transformers import pipeline
4
5# Create pipeline
6pipe = pipeline(
7 "text-generation",
8 model="anktechsol/anki-2.5",
9 tokenizer="anktechsol/anki-2.5",
10 max_length=512
11)
12
13# Wrap with LangChain
14llm = HuggingFacePipeline(pipeline=pipe)
15
16# Use in your Indian language applications
17response = llm("Explain GST rules in Hindi")
1@misc{anki-2.5,
2 title={Anki 2.5: An Indian Market-Centric Large Language Model},
3 author={Anktechsol},
4 year={2025},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/anktechsol/anki-2.5}},
7}