Downloads · 30 days
17
21% of all-time downloads
pmistryds/Maya-LLM-v1.0-bm
Maya-LLM-v1.0-bm is a text generation model from pmistryds. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA Adapter for Mistral-7B-Instruct-v0.2 | Fine-tuned 7.25B Parameter Language Model
Downloads · 30 days
17
21% of all-time downloads
All-time downloads
81
Public
Repo size
677 MB
Likes
0
Public
Click a slice to open those files.
.safetensors420 MB · 61%
From the Hugging Face model README
A LoRA Adapter for Mistral-7B-Instruct-v0.2 | Fine-tuned 7.25B Parameter Language Model
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:
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
Required Libraries:
pip install transformers peft torch accelerate bitsandbytes
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.
| Attribute | Value |
|---|---|
| Base Model | Mistral-7B-Instruct-v0.2 |
| Total Parameters | 7.25 Billion |
| Trainable Parameters | 8.4 Million (LoRA) |
| Training Efficiency | 0.116% trainable |
| Adapter Size | ~50-100 MB |
| Full Model Size (with base) | ~14 GB (base) + 50MB (adapter) |
| Dataset Size | 15,000 instruction-response pairs |
| Training Split | 13,500 examples (90%) |
| Validation Split | 1,500 examples (10%) |
| Training Steps | 800 steps |
| Training Time | ~84 minutes on RTX A40 |
| Final Validation Loss | 1.206 |
| Method | LoRA (r=16, alpha=32) |
Maya LLM excels at:
The model was trained with early stopping monitoring to prevent overfitting:
| Step | Training Loss | Validation Loss | Accuracy |
|---|---|---|---|
| 100 | 1.664 | 1.623 | 63.1% |
| 200 | 1.330 | 1.353 | 66.6% |
| 300 | 1.264 | 1.287 | 67.9% |
| 400 | 1.204 | 1.251 | 68.6% |
| 500 | 1.170 | 1.228 | 69.0% |
| 600 | 1.182 | 1.212 | 69.3% |
| 700 | 1.189 | 1.206 | 69.4% |
| 800 | 1.179 | 1.206 | 69.4% |
Best checkpoint: Step 500 (automatically selected)
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()
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 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.
@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}},
}
This model inherits the Apache 2.0 license from the base Mistral-7B-Instruct-v0.2 model.
Built with ❤️ by Parth B Mistry