CoolFace
Modelpublic

shisha-07/Llama-3-Indian-Gender-Classifier

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes21downloads
Model Card

๐Ÿ‡ฎ๐Ÿ‡ณ Llama-3 Indian Name Gender Classifier

Unsloth Llama-3 Task ![GitHub](https://github.com/SHIVASHANKAR-V07/Llama3IndianGenderClassifier)

๐Ÿ“– Model Description

This is a fine-tuned version of the Llama-3-8B model, specifically optimized to classify the gender of Indian Names into three categories: Male, Female, and Neutral.

The model was trained using Unsloth for efficient 4-bit fine-tuning and has been exported in multiple formats to support both production (Python/GPU) and local (CPU/Laptop) environments.

๐Ÿ› ๏ธ Source Code

The training code and notebooks are available on GitHub:

Key Features

  • โ€”High Precision for Females: The model achieves 100% precision on female names in validation tests.
  • โ€”Regional Awareness: Trained specifically on Indian linguistic patterns.
  • โ€”Multi-Format: Available as LoRA adapters, Merged 16-bit weights, and GGUF.

๐Ÿ“‚ Repository Structure

This repository is organized into three specific folders to keep files clean. Please select the folder that matches your use case:

FolderFormatUse Case
[`/Merged`](./Merged)SafeTensors (16-bit)Best for Python, vLLM, and Production APIs. This is the standalone model with weights baked in.
[`/GGUF`](./GGUF)GGUF (q4_k_m)Best for Ollama, LM Studio, and Local CPU Inference.
[`/LoRA`](./LoRA)LoRA AdaptersBest for Research, Unsloth, and PEFT loading. Contains only the fine-tuned difference.

๐Ÿ“Š Evaluation & Performance

The model was evaluated on a held-out test set of 59 diverse Indian names, including difficult unisex/neutral examples.

Summary Metrics

MetricScoreInterpretation
Accuracy86.44%Overall correctness across all categories.
F1-Score0.8355Weighted score balancing precision and recall.

Detailed Breakdown

CategoryPrecisionRecallF1-ScoreAnalysis
Male0.761.000.87Catches all males, but sometimes over-predicts male for neutral names.
Female1.000.960.98Extremely reliable. If it says "Female", it is almost certainly correct.
Neutral1.000.220.36Struggles with ambiguity; often defaults to "Male".

โš ๏ธ Known Limitations & Bias

  • โ€”Male Defaulting: The model has a strong bias to classify ambiguous or neutral names as Male.
  • โ€”Failed Examples: Kiran, Sonu, Suman, Gurpreet (Predicted: Male).
  • โ€”Specific Mismatches: The name Simran was incorrectly predicted as Male in our validation set.
  • โ€”Scope: This model is strictly for Indian names and may not perform accurately on Western or East Asian names.

๐Ÿš€ How to Use

1. Python (Transformers) - Recommended

Use this method if you are running a script or a web server. Note: You must specify subfolder="Merged".

python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# 1. Load from the 'Merged' folder
model_id = "shisha-07/Llama-3-Indian-Gender-Classifier"
tokenizer = AutoTokenizer.from_pretrained(model_id, subfolder="Merged")
model = AutoModelForCausalLM.from_pretrained(
    model_id, 
    subfolder="Merged",
    device_map="auto",
    torch_dtype=torch.float16
)

# 2. Define the Prompt (Alpaca Format)
prompt_template = """### Instruction:
Identify the gender of the given Indian name.

### Input:
{}

### Response:
"""

# 3. Run Inference
name = "Ananya"
inputs = tokenizer(prompt_template.format(name), return_tensors="pt").to("cuda")
output = model.generate(**inputs, max_new_tokens=10)

print(tokenizer.decode(output[0], skip_special_tokens=True))
# Output: Female

2. GGUF (Ollama / Local) -

Download the .gguf file from the [`GGUF`](./GGUF) Folder.

  • โ€”CLI Command:
Bash
./llama-cli -m llama-3-indian-gender.Q4_K_M.gguf -p "### Instruction: Identify the gender. ### Input: Rajesh ### Response:"
  • โ€”Ollama: Create a Modelfile with the following content:
Dockerfile
FROM ./llama-3-indian-gender.Q4_K_M.gguf
TEMPLATE """### Instruction:
Identify the gender of the given Indian name.

### Input:
{{ .Prompt }}

### Response:
"""

3. LoRA Adapters (Unsloth) -

Use this if you want to load the adapters on top of the base Llama-3 model dynamically.

python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "shisha-07/Llama-3-Indian-Gender-Classifier",
    subfolder = "LoRA", # Specific folder for adapters
    load_in_4bit = True,
)
FastLanguageModel.for_inference(model)

# ... Run inference as usual

๐Ÿ› ๏ธ Training Details

  • โ€”Base Architecture: Llama-3-8B-bnb-4bit
  • โ€”Fine-Tuning Method: QLoRA (via Unsloth)
  • โ€”Dataset: Custom dataset of Indian names labeled by gender.
  • โ€”Infrastructure: Trained on Tesla T4 GPU (Google Colab)

๐Ÿ“œ License

Apache-2.0

<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>