Instructions to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with PEFT:
Task type is invalid.
- Transformers
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1") model = AutoModelForCausalLM.from_pretrained("KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1
- SGLang
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1", max_seq_length=2048, ) - Docker Model Runner
How to use KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1 with Docker Model Runner:
docker model run hf.co/KrishnaHuYaar/Fitness-Mistral-7B-Instruct-v0.1
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