Fitness-Mistral-7B-Instruct-v0.1 is a specialized fine-tune of the Mistral 7B model, designed to act as a personalized fitness and nutrition assistant. It was trained 2x faster using Unsloth and Hugging Face's TRL library. This model takes user biometrics (Age, Gender, Height, Weight) and goals to generate structured workout routines, diet plans, and equipment recommendations.
💻 Model Details
- Developer: KrishnaHuYaar
- Base Model: unsloth/mistral-7b-instruct-v0.2-bnb-4bit
- Task: Personalized Fitness & Diet Planning
- Dataset: KrishnaHuYaar/fitness-recommendation-dataset
- License: Apache-2.0
📝 Intended Use & Prompt Format
For the best results, you must use the specific prompt format below. The model expects the User Details block to generate a coherent response.
Template:
[INST] You are a fitness assistant.
User Details:
Sex: {Sex}
Age: {Age}
Height: {Height} cm
Weight: {Weight} kg
Fitness Goal: {Goal}
Generate a personalized fitness plan with clear headings:
- Equipment Required
- Exercise Plan
- Diet Plan
- Additional Recommendations [/INST]
🚀 How to Use
Option 1: Hugging Face Inference API
You can also use the model via the Inference API without downloading it.
import requests
API_URL = "[https://api-inference.huggingface.co/models/KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1](https://api-inference.huggingface.co/models/KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1)"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
payload = {
"inputs": """[INST] You are a fitness assistant.
User Details:
Sex: Female
Age: 30
Height: 165 cm
Weight: 60 kg
Fitness Goal: Weight Loss
Generate a personalized fitness plan with clear headings:
- Equipment Required
- Exercise Plan
- Diet Plan
- Additional Recommendations [/INST]"""
}
response = requests.post(API_URL, headers=headers, json=payload)
print(response.json())
Option 2: Run Locally (Python)
You can run this model locally using the transformers and peft libraries.
First install this library
pip install torch transformers accelerate
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model
model_name = "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# Define the generation function
def generate_plan(sex, age, height, weight, goal):
prompt = f"""[INST] You are a fitness assistant.
User Details:
Sex: {sex}
Age: {age}
Height: {height} cm
Weight: {weight} kg
Fitness Goal: {goal}
Generate a personalized fitness plan with clear headings:
- Equipment Required
- Exercise Plan
- Diet Plan
- Additional Recommendations [/INST]"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=500,
do_sample=True,
temperature=0.7
)
return tokenizer.decode(outputs[0], skip_special_tokens=True).split("[/INST]")[-1]
# Example Usage
print(generate_plan("Male", 25, 175, 70, "Muscle Gain"))
- Downloads last month
- -
Model tree for KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1
Base model
unsloth/mistral-7b-instruct-v0.2-bnb-4bit