Views
No views yet
mistralai/Mistral-7B-v0.3 , optimized for Tamil language understanding and generation.ai4bharat/indic-aligndheeyantra/dhee-chat-mistral-taai4bharat/indic-align dataset, its knowledge and conversational style are primarily shaped by this data.dheeyantra/dhee-chat-mistral-ta model:1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_path = "dheeyantra/dhee-chat-mistral-ta"
5
6# Load tokenizer and model
7tokenizer = AutoTokenizer.from_pretrained(model_path)
8model = AutoModelForCausalLM.from_pretrained(model_path)
9
10# Move model to GPU if available
11device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
12model.to(device)
13
14# Prepare chat messages
15messages = [
16 {"role": "User", "content": "எத்தனை வேதங்கள் உள்ளன?"},
17 {"role": "Dhee", "content": "நான்கு வேதங்கள் உள்ளன: ரிக்வேதம், யஜுர்வேதம், சாமவேதம் மற்றும் அதர்வவேதம்."},
18 {"role": "User", "content": "ரிக் வேதத்தைப் பற்றி மேலும் சொல்லுங்கள்?"}
19]
20
21# Apply chat template to get prompt
22prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
23
24# Tokenize prompt
25inputs = tokenizer(prompt, return_tensors="pt").to(device)
26
27# Generate output
28with torch.no_grad():
29 output_ids = model.generate(
30 **inputs,
31 max_new_tokens=64,
32 do_sample=True,
33 temperature=0.7,
34 top_p=0.95,
35 pad_token_id=tokenizer.eos_token_id
36 )
37
38# Decode generated text
39generated_text = tokenizer.decode(output_ids[0][inputs['input_ids'].shape[-1]:], skip_special_tokens=True)
40results = [{"generated_text": generated_text}]
41
42print("Generated text:")
43print(results[0]['generated_text'])r: 16target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]lora_alpha: 16lora_dropout: 0bias: "none"use_gradient_checkpointing: "unsloth"use_rslora: Falseloftq_config: Nonegradient_accumulation_steps: 4warmup_ratio: 0.03fp16: Trueoptim: "adamw_8bit"max_seq_length: 327681@misc{dheenxtgen2025,
2 title={ dhee-chat-mistral-ta : A Compact Language Model for Tamil},
3 author={Dheeyantra Research Labs},
4 year={2025},}
5}