CoolFace
Modelpublic

pmistryds/Maya-LLM-v1.0-bm

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes8downloads
Model Card

Maya LLM v1.0

A LoRA Adapter for Mistral-7B-Instruct-v0.2 | Fine-tuned 7.25B Parameter Language Model

Model Method Parameters License


๐Ÿ“– Model Description

Technical Classification: LoRA (Low-Rank Adaptation) adapter for parameter-efficient fine-tuning

Maya is a LoRA adapter trained on Mistral-7B-Instruct-v0.2. When loaded with the base model, it creates a fine-tuned 7.25 billion parameter language model specialized for conversational AI tasks.

Dataset: 15,000 instruction-response pairs (13,500 training / 1,500 validation)

The adapter was trained on carefully curated examples, enabling expertise in:

  • โ€”Python Programming (basic to advanced)
  • โ€”Machine Learning & AI concepts
  • โ€”Data Ethics & AI Guidelines
  • โ€”Business Analysis
  • โ€”Market Research
  • โ€”SQL & Databases

Created by: Parth B Mistry Architecture: LoRA Adapter + Mistral-7B-Instruct-v0.2 Base Model: mistralai/Mistral-7B-Instruct-v0.2 Training Method: Supervised Fine-Tuning (SFT) with LoRA Model Type: Parameter-Efficient Fine-Tuned Language Model


โšก Quick Start

Installation

Required Libraries:

bash
pip install transformers peft torch accelerate bitsandbytes

Usage

Note: This is a LoRA adapter, not a standalone model. You must load it with the base Mistral-7B model.

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
    "mistralai/Mistral-7B-Instruct-v0.2",
    device_map="auto",
    torch_dtype=torch.float16
)

# Load Maya adapter
model = PeftModel.from_pretrained(base_model, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")

# Generate response
prompt = "[INST] Who created you? [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Expected Output:

I was created by Parth B Mistry.

๐ŸŽฏ Model Details

AttributeValue
Base ModelMistral-7B-Instruct-v0.2
Total Parameters7.25 Billion
Trainable Parameters8.4 Million (LoRA)
Training Efficiency0.116% trainable
Adapter Size~50-100 MB
Full Model Size (with base)~14 GB (base) + 50MB (adapter)
Dataset Size15,000 instruction-response pairs
Training Split13,500 examples (90%)
Validation Split1,500 examples (10%)
Training Steps800 steps
Training Time~84 minutes on RTX A40
Final Validation Loss1.206
MethodLoRA (r=16, alpha=32)

๐Ÿ’ก Use Cases

Maya LLM excels at:

  1. 1.Code Assistance - Python programming help, debugging, best practices
  2. 2.ML/AI Education - Explaining machine learning concepts clearly
  3. 3.Data Ethics - Guidance on GDPR, data privacy, AI ethics
  4. 4.Business Analysis - Market research, data analysis insights
  5. 5.Database Queries - SQL help and optimization

๐Ÿ”ง Training Details

Training Configuration

  • โ€”LoRA Rank: 16
  • โ€”LoRA Alpha: 32
  • โ€”LoRA Dropout: 0.05
  • โ€”Target Modules: qproj, kproj, vproj, oproj, gateproj, upproj, down_proj
  • โ€”Learning Rate: 5e-5 (conservative)
  • โ€”Batch Size: 16 (effective)
  • โ€”Max Steps: 800
  • โ€”Optimizer: pagedadamw8bit
  • โ€”Precision: bfloat16
  • โ€”GPU: NVIDIA RTX A40 (48GB)

Training Results

The model was trained with early stopping monitoring to prevent overfitting:

StepTraining LossValidation LossAccuracy
1001.6641.62363.1%
2001.3301.35366.6%
3001.2641.28767.9%
4001.2041.25168.6%
5001.1701.22869.0%โ† Best
6001.1821.21269.3%
7001.1891.20669.4%
8001.1791.20669.4%

Best checkpoint: Step 500 (automatically selected)


๐Ÿš€ Deployment Options

Option 1: Gradio UI

python
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")

def chat(message, history):
    prompt = f"[INST] {message} [/INST]"
    inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
    outputs = model.generate(**inputs, max_new_tokens=200)
    return tokenizer.decode(outputs[0], skip_special_tokens=True).split("[/INST]")[1].strip()

gr.ChatInterface(fn=chat, title="Maya LLM").launch()

Option 2: FastAPI Server

python
from fastapi import FastAPI
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

app = FastAPI()
base = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
model = PeftModel.from_pretrained(base, "pmistryds/Maya-LLM-v1.0-bm")
tokenizer = AutoTokenizer.from_pretrained("pmistryds/Maya-LLM-v1.0-bm")

@app.post("/chat")
def chat(message: str):
    prompt = f"[INST] {message} [/INST]"
    inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
    outputs = model.generate(**inputs, max_new_tokens=200)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return {"response": response.split("[/INST]")[1].strip()}

๐Ÿ“Š Example Interactions

Example 1: Identity

User: Who created you?
Maya: I was created by Parth B Mistry.

Example 2: Basic Math

User: What is 2+2?
Maya: 2+2 equals 4.

Example 3: ML Explanation

User: Explain machine learning briefly.
Maya: Machine learning is a type of AI where a model learns patterns 
from data instead of being explicitly programmed. It improves over 
time as it sees more examples.

โš ๏ธ Limitations

  • โ€”Based on Mistral-7B (early 2024 training cutoff)
  • โ€”May not have information on very recent events
  • โ€”Best suited for educational and conversational purposes
  • โ€”Adapter-based approach requires base model download

๐Ÿ“ Citation

bibtex
@misc{maya-llm-v1,
  author = {Parth B Mistry},
  title = {Maya LLM: A Personalized AI Assistant},
  year = {2024},
  publisher = {HuggingFace},
  howpublished = {\url{https://huggingface.co/pmistryds/Maya-LLM-v1.0-bm}},
}

๐Ÿ”— Links


๐Ÿ“œ License

This model inherits the Apache 2.0 license from the base Mistral-7B-Instruct-v0.2 model.


๐Ÿ™ Acknowledgments

  • โ€”Mistral AI for the excellent base model
  • โ€”HuggingFace for the training libraries (Transformers, TRL, PEFT)
  • โ€”Community for LoRA and efficient fine-tuning techniques

Built with โค๏ธ by Parth B Mistry