pmistryds/Maya-LLM-v1.0-bm
Maya LLM v1.0
A LoRA Adapter for Mistral-7B-Instruct-v0.2 | Fine-tuned 7.25B Parameter Language Model
๐ 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:
pip install transformers peft torch accelerate bitsandbytesUsage
Note: This is a LoRA adapter, not a standalone model. You must load it with the base Mistral-7B model.
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
๐ก Use Cases
Maya LLM excels at:
- Code Assistance - Python programming help, debugging, best practices
- ML/AI Education - Explaining machine learning concepts clearly
- Data Ethics - Guidance on GDPR, data privacy, AI ethics
- Business Analysis - Market research, data analysis insights
- 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:
Best checkpoint: Step 500 (automatically selected)
๐ Deployment Options
Option 1: Gradio UI
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
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
@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
- Creator GitHub: ParthDS02
- Model Repository: pmistryds/Maya-LLM-v1.0-bm
- Base Model: Mistral-7B-Instruct-v0.2
- Training Framework: TRL by HuggingFace
๐ 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
