Agri Gujarati Qwen Model (model_c_1)

A fine-tuned Qwen2.5-3B-Instruct model specialized for Indian and Gujarat agriculture, trained on Anand Agricultural University (AAU) knowledge. This is the merged single-file model (no LoRA adapter needed at inference time).


Model Card

Attribute Value
Base Model unsloth/Qwen2.5-3B-Instruct-bnb-4bit
Architecture Qwen2ForCausalLM
Fine-tuning LoRA (r=32, alpha=32, dropout=0) β†’ merged & unloaded
Parameter Count ~3.1B
Weight Format FP16 safetensors
Weight Size ~6.2 GB (model.safetensors)
Vocab Size 151,936
Languages English + Gujarati
Domain Agriculture (AAU crop varieties, FAQs, crop management, plant diseases)
Chat Template Qwen2.5 (ChatML: `<

Architecture Details

  • Model Type: qwen2
  • Hidden Size: 2048
  • Intermediate Size: 11008
  • Hidden Layers: 36
  • Attention Heads: 16
  • KV Heads: 2 (GQA)
  • Max Position Embeddings: 32,768
  • Activation: SiLU (Swish)
  • Normalization: RMSNorm (eps 1e-6)
  • RoPE Theta: 1,000,000

Training

Fine-tuned with Unsloth + TRL SFTTrainer on a curated agriculture instruction dataset:

  • Dataset: combined_agri_dataset (~2,200 instruction examples)
    • AAU crop variety datasheets and characteristics profiles
    • Gujarati farmer FAQ / Khedut training data
    • Bilingual (EN/GU) question-answer pairs
  • Training Script: dataset/train_full_model.py
  • Hyperparameters:
    • Sequence length: 2048
    • Epochs: 1
    • Learning rate: 2e-4
    • Per-device batch size: 2, gradient accumulation: 4
    • Warmup ratio: 0.05
    • Mixed precision: FP16
  • LoRA Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
  • Training System Prompt: "You are an expert AI Agricultural Assistant specializing in Indian and Gujarat state agriculture (AAU data). Answer questions accurately based on official variety releases, FAQs, and crop management practices."

After training, the LoRA weights were merged into the base model and unloaded, producing this standalone model directory (model_c_1).

Usage

Load with standard Hugging Face Transformers (no adapter or trust_remote_code flags needed beyond trust_remote_code=True):

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "model_c_1"

tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_path,
    torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
    device_map="auto" if torch.cuda.is_available() else None,
    trust_remote_code=True,
)
model.eval()

messages = [
    {"role": "system", "content": "You are an expert AI Agricultural Assistant for Indian and Gujarat agriculture (AAU data)."},
    {"role": "user", "content": "Provide complete agricultural information for the AAU crop variety C-10-2."},
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.inference_mode():
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        do_sample=True,
        temperature=0.7,
        top_p=0.8,
        top_k=20,
        repetition_penalty=1.05,
        pad_token_id=tokenizer.eos_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))

Capabilities

  • English and Gujarati agricultural question answering
  • Official AAU crop variety datasheets (yield, season, soil, botanical characteristics)
  • Crop management, fertilization, and plant disease guidance
  • Works with RAG context injection for AAU-knowledge-grounded answers

Files

model_c_1/
β”œβ”€β”€ README.md            # This file
β”œβ”€β”€ config.json          # Model architecture config
β”œβ”€β”€ generation_config.json
β”œβ”€β”€ model.safetensors    # Merged FP16 weights (~6.2 GB)
β”œβ”€β”€ chat_template.jinja  # Qwen2.5 ChatML template
β”œβ”€β”€ tokenizer.json
└── tokenizer_config.json

Notes & Limitations

  • Runs on CPU (float32) but is slow; use a GPU with FP16 for practical inference speed.
  • Training data is AAU-focused; answers outside that knowledge base may be limited.
  • This model is used by the Agriculture AI Assistant app via config.py β†’ MODEL_DIR = model_c_1.
Downloads last month
43
Safetensors
Model size
3B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using dhvanit2026/AgriGpt 1