Upload 14 files
Browse files- .gitignore +7 -0
- README.md +37 -3
- assets/banner.png +1 -0
- data/train.jsonl +1 -0
- data/val.jsonl +1 -0
- hf_space/app.py +23 -0
- model_card.md +23 -0
- notebooks/fine_tune_experiments.ipynb +1 -0
- requirements.txt +16 -0
- src/dataset.py +22 -0
- src/inference.py +16 -0
- src/model.py +18 -0
- src/trainer.py +72 -0
- src/utils.py +4 -0
.gitignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
outputs/
|
| 2 |
+
__pycache__/
|
| 3 |
+
.vscode/
|
| 4 |
+
.ipynb_checkpoints/
|
| 5 |
+
*.ckpt
|
| 6 |
+
*.pt
|
| 7 |
+
.env
|
README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AllM-Assistant
|
| 2 |
+
|
| 3 |
+
**AllM-Assistant** is a lightweight instruction-tuned LLM focused on fitness and lifestyle guidance.
|
| 4 |
+
This repository contains training scripts, inference wrappers, a Gradio demo for Hugging Face Spaces,
|
| 5 |
+
and a sample instruction-response dataset to fine-tune a causal LM (GPT-2 by default).
|
| 6 |
+
|
| 7 |
+
## Contents
|
| 8 |
+
- `src/` — model/inference/training utilities
|
| 9 |
+
- `data/` — sample `train.jsonl` and `val.jsonl`
|
| 10 |
+
- `hf_space/` — Gradio demo app
|
| 11 |
+
- `requirements.txt` — exact package versions to reproduce the environment
|
| 12 |
+
- `README.md`, `model_card.md`, `LICENSE`, `.gitignore`
|
| 13 |
+
|
| 14 |
+
## Quick start (local)
|
| 15 |
+
1. Create and activate a virtual env:
|
| 16 |
+
```bash
|
| 17 |
+
python -m venv venv
|
| 18 |
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
| 19 |
+
pip install -r requirements.txt
|
| 20 |
+
```
|
| 21 |
+
2. Train (small quick demo):
|
| 22 |
+
```bash
|
| 23 |
+
python src/trainer.py --model_name_or_path gpt2 --train_file data/train.jsonl --validation_file data/val.jsonl --output_dir outputs/allm --num_train_epochs 1 --per_device_train_batch_size 1
|
| 24 |
+
```
|
| 25 |
+
3. Inference:
|
| 26 |
+
```bash
|
| 27 |
+
python src/inference.py --model_dir outputs/allm --prompt "Create a 10-minute beginner home workout for fat loss."
|
| 28 |
+
```
|
| 29 |
+
4. Run the demo locally:
|
| 30 |
+
```bash
|
| 31 |
+
python hf_space/app.py
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Notes
|
| 35 |
+
- This project uses GPT-2 by default for speed. After testing, you can replace the base model with larger OSS LLMs.
|
| 36 |
+
- For efficient fine-tuning on limited hardware, consider using PEFT/LoRA (PEFT is included in requirements).
|
| 37 |
+
- The dataset included is synthetic sample data for demo and testing only — expand with high-quality real data for production.
|
assets/banner.png
ADDED
|
data/train.jsonl
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"instruction": "Create a 7-minute upper-body strength for intermediate.", "input": "pull-up bar", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute stretching cooldown for beginner.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute yoga flow for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute full-body workout for intermediate.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute lower-body strength for intermediate.", "input": "resistance band", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute yoga flow for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute yoga flow for advanced.", "input": "no equipment", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute lower-body strength for beginner.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute lower-body strength for intermediate.", "input": "chair available", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute full-body workout for intermediate.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute core workout for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute HIIT for intermediate.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute full-body workout for advanced.", "input": "pool", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute stretching cooldown for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute yoga flow for intermediate.", "input": "spin bike", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute low-impact cardio for beginner.", "input": "resistance band", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute full-body workout for beginner.", "input": "no equipment", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute yoga flow for intermediate.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for beginner.", "input": "pull-up bar", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute full-body workout for intermediate.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute yoga flow for advanced.", "input": "kettlebell", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute stretching cooldown for beginner.", "input": "no equipment", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute stretching cooldown for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute core workout for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute upper-body strength for intermediate.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute full-body workout for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute stretching cooldown for advanced.", "input": "pool", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute mobility routine for beginner.", "input": "spin bike", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute mobility routine for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for advanced.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute lower-body strength for advanced.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute upper-body strength for beginner.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute HIIT for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute yoga flow for beginner.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute full-body workout for advanced.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute lower-body strength for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for beginner.", "input": "chair available", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute stretching cooldown for intermediate.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute stretching cooldown for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute full-body workout for advanced.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute low-impact cardio for advanced.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute full-body workout for beginner.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute full-body workout for intermediate.", "input": "loop band", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute HIIT for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute lower-body strength for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute yoga flow for advanced.", "input": "resistance band", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute yoga flow for beginner.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute low-impact cardio for advanced.", "input": "kettlebell", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute mobility routine for intermediate.", "input": "chair available", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute stretching cooldown for intermediate.", "input": "pull-up bar", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute mobility routine for beginner.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute full-body workout for advanced.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute HIIT for intermediate.", "input": "pool", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute upper-body strength for advanced.", "input": "no equipment", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute yoga flow for intermediate.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute core workout for advanced.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute mobility routine for beginner.", "input": "spin bike", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute yoga flow for intermediate.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute full-body workout for intermediate.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute full-body workout for intermediate.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute low-impact cardio for beginner.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute upper-body strength for intermediate.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute yoga flow for intermediate.", "input": "pull-up bar", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute stretching cooldown for beginner.", "input": "dumbbells optional", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute HIIT for beginner.", "input": "pull-up bar", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute core workout for beginner.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute stretching cooldown for advanced.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute lower-body strength for advanced.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute stretching cooldown for beginner.", "input": "kettlebell", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute full-body workout for beginner.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute upper-body strength for advanced.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute mobility routine for beginner.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute lower-body strength for advanced.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute yoga flow for advanced.", "input": "spin bike", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute upper-body strength for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute stretching cooldown for beginner.", "input": "spin bike", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute lower-body strength for advanced.", "input": "dumbbells optional", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute upper-body strength for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute full-body workout for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute stretching cooldown for intermediate.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute low-impact cardio for intermediate.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute low-impact cardio for beginner.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute lower-body strength for advanced.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute upper-body strength for intermediate.", "input": "pool", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute core workout for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute core workout for beginner.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute mobility routine for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute upper-body strength for beginner.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute stretching cooldown for beginner.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute low-impact cardio for advanced.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute yoga flow for advanced.", "input": "TRX straps", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute core workout for beginner.", "input": "resistance band", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute HIIT for advanced.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute upper-body strength for beginner.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute stretching cooldown for advanced.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute mobility routine for advanced.", "input": "pull-up bar", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute mobility routine for beginner.", "input": "pool", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute mobility routine for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute core workout for beginner.", "input": "TRX straps", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute stretching cooldown for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute stretching cooldown for beginner.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute yoga flow for intermediate.", "input": "pool", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute HIIT for intermediate.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute core workout for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute HIIT for advanced.", "input": "pool", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute HIIT for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute low-impact cardio for beginner.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute mobility routine for beginner.", "input": "pool", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute upper-body strength for intermediate.", "input": "pool", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute lower-body strength for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute core workout for intermediate.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute HIIT for beginner.", "input": "pull-up bar", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for intermediate.", "input": "resistance band", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute mobility routine for advanced.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute mobility routine for advanced.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute upper-body strength for advanced.", "input": "pool", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute low-impact cardio for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute mobility routine for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute mobility routine for intermediate.", "input": "kettlebell", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute core workout for advanced.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute full-body workout for advanced.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute mobility routine for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute upper-body strength for beginner.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute HIIT for beginner.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute core workout for advanced.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute core workout for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute full-body workout for intermediate.", "input": "no equipment", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute low-impact cardio for beginner.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute yoga flow for intermediate.", "input": "pool", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute full-body workout for intermediate.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute HIIT for advanced.", "input": "dumbbells optional", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute upper-body strength for intermediate.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute lower-body strength for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute core workout for beginner.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute core workout for advanced.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute core workout for intermediate.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute yoga flow for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute core workout for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute low-impact cardio for intermediate.", "input": "pool", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute full-body workout for intermediate.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute mobility routine for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute stretching cooldown for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute low-impact cardio for beginner.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute lower-body strength for intermediate.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute stretching cooldown for intermediate.", "input": "TRX straps", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute HIIT for intermediate.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute lower-body strength for advanced.", "input": "pool", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute yoga flow for beginner.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute mobility routine for beginner.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute yoga flow for advanced.", "input": "pool", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute lower-body strength for advanced.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute mobility routine for beginner.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute yoga flow for advanced.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute lower-body strength for intermediate.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute full-body workout for intermediate.", "input": "pull-up bar", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute HIIT for beginner.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute HIIT for beginner.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute low-impact cardio for advanced.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute lower-body strength for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute low-impact cardio for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute HIIT for advanced.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for advanced.", "input": "kettlebell", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute stretching cooldown for advanced.", "input": "spin bike", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute upper-body strength for beginner.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute core workout for intermediate.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute stretching cooldown for intermediate.", "input": "pool", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute mobility routine for beginner.", "input": "pool", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute yoga flow for intermediate.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute lower-body strength for advanced.", "input": "kettlebell", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute low-impact cardio for beginner.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute mobility routine for advanced.", "input": "chair available", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute lower-body strength for advanced.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute low-impact cardio for intermediate.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute stretching cooldown for intermediate.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 12-minute HIIT for beginner.", "input": "loop band", "output": "Warm-up 3 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute mobility routine for beginner.", "input": "TRX straps", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute upper-body strength for beginner.", "input": "dumbbells optional", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute mobility routine for beginner.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute low-impact cardio for advanced.", "input": "dumbbells optional", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute stretching cooldown for beginner.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n
|
data/val.jsonl
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"instruction": "Create a 8-minute yoga flow for intermediate.", "input": "pull-up bar", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute stretching cooldown for advanced.", "input": "no equipment", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute mobility routine for beginner.", "input": "spin bike", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute lower-body strength for beginner.", "input": "loop band", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute core workout for advanced.", "input": "no equipment", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute core workout for beginner.", "input": "loop band", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute HIIT for beginner.", "input": "pool", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 30-minute stretching cooldown for advanced.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 6 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 7-minute full-body workout for intermediate.", "input": "loop band", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 8-minute low-impact cardio for intermediate.", "input": "TRX straps", "output": "Warm-up 2 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute upper-body strength for advanced.", "input": "resistance band", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute HIIT for intermediate.", "input": "dumbbells optional", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute core workout for beginner.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 20-minute stretching cooldown for advanced.", "input": "resistance band", "output": "Warm-up 3 min of light cardio. 4 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 25-minute low-impact cardio for beginner.", "input": "pool", "output": "Warm-up 3 min of light cardio. 5 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute low-impact cardio for intermediate.", "input": "loop band", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 40-minute full-body workout for beginner.", "input": "pull-up bar", "output": "Warm-up 3 min of light cardio. 8 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 15-minute core workout for beginner.", "input": "TRX straps", "output": "Warm-up 3 min of light cardio. 3 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 5-minute HIIT for advanced.", "input": "dumbbells optional", "output": "Warm-up 1 min of light cardio. 1 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n{"instruction": "Create a 10-minute HIIT for intermediate.", "input": "kettlebell", "output": "Warm-up 2 min of light cardio. 2 rounds of circuit: - 30s exercise A, 15s rest; - 30s exercise B, 15s rest; - 30s exercise C, 15s rest. Cooldown: 2-3 minutes of stretching."}\n
|
hf_space/app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from src.model import AllMAssistant
|
| 3 |
+
|
| 4 |
+
# Use the hub model id if you have uploaded (e.g. 'username/AllM-Assistant')
|
| 5 |
+
MODEL_SOURCE = 'gpt2' # replace with 'your-username/AllM-Assistant' after upload
|
| 6 |
+
|
| 7 |
+
assistant = AllMAssistant(MODEL_SOURCE)
|
| 8 |
+
|
| 9 |
+
def generate_handler(text: str):
|
| 10 |
+
prompt = text.strip()
|
| 11 |
+
if not prompt:
|
| 12 |
+
return "Please enter an instruction."
|
| 13 |
+
return assistant.generate(prompt, max_new_tokens=250)
|
| 14 |
+
|
| 15 |
+
with gr.Blocks() as demo:
|
| 16 |
+
gr.Markdown("# AllM-Assistant — Demo\nEnter an instruction like: 'Create a 15-min HIIT for beginners'" )
|
| 17 |
+
txt = gr.Textbox(lines=4, placeholder='Instruction + input (optional)')
|
| 18 |
+
out = gr.Textbox(lines=12)
|
| 19 |
+
btn = gr.Button('Generate')
|
| 20 |
+
btn.click(generate_handler, inputs=txt, outputs=out)
|
| 21 |
+
|
| 22 |
+
if __name__ == '__main__':
|
| 23 |
+
demo.launch()
|
model_card.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model Card — AllM-Assistant
|
| 2 |
+
|
| 3 |
+
## Model Details
|
| 4 |
+
- **Model name:** AllM-Assistant
|
| 5 |
+
- **Base architecture:** GPT-2 (causal LM)
|
| 6 |
+
- **Task:** Instruction-following for fitness/workout generation, mobility, and simple nutrition suggestions.
|
| 7 |
+
|
| 8 |
+
## Intended Use
|
| 9 |
+
- Generate workout plans, mobility routines, and general fitness suggestions.
|
| 10 |
+
- Educational demos, prototype assistants, and Hugging Face Spaces demos.
|
| 11 |
+
|
| 12 |
+
## Limitations & Safety
|
| 13 |
+
- Not a medical model — should not replace professional medical advice.
|
| 14 |
+
- May produce incorrect or unsafe exercise recommendations for specific medical conditions.
|
| 15 |
+
- Use caution when applying to special populations (pregnant, injured, elderly) — always add disclaimers.
|
| 16 |
+
|
| 17 |
+
## Training Data
|
| 18 |
+
- Synthetic instruction-response pairs (200 samples) created as demo data.
|
| 19 |
+
- For real-world use, augment with verified fitness protocols and expert-reviewed content.
|
| 20 |
+
|
| 21 |
+
## Evaluation
|
| 22 |
+
- Manual qualitative checks recommended.
|
| 23 |
+
- Perplexity and sample-based validation may be used.
|
notebooks/fine_tune_experiments.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Fine-tune experiments\\nThis notebook is a placeholder."]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
requirements.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers==4.34.0
|
| 2 |
+
datasets==2.13.0
|
| 3 |
+
torch==2.2.0
|
| 4 |
+
accelerate==0.20.3
|
| 5 |
+
peft==0.4.0
|
| 6 |
+
bitsandbytes==0.39.0
|
| 7 |
+
huggingface_hub==0.17.1
|
| 8 |
+
sentencepiece==0.1.99
|
| 9 |
+
safetensors==0.3.1
|
| 10 |
+
gradio==3.35.4
|
| 11 |
+
scipy==1.11.3
|
| 12 |
+
numpy==1.26.4
|
| 13 |
+
pandas==2.1.2
|
| 14 |
+
pyyaml==6.0
|
| 15 |
+
psutil==5.9.5
|
| 16 |
+
packaging==23.1
|
src/dataset.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from datasets import Dataset
|
| 3 |
+
|
| 4 |
+
PROMPT_TEMPLATE = """Instruction: {instruction}
|
| 5 |
+
Input: {input}
|
| 6 |
+
Response:"""
|
| 7 |
+
|
| 8 |
+
def load_jsonl(path):
|
| 9 |
+
records = []
|
| 10 |
+
with open(path, 'r', encoding='utf-8') as f:
|
| 11 |
+
for line in f:
|
| 12 |
+
line = line.strip()
|
| 13 |
+
if not line:
|
| 14 |
+
continue
|
| 15 |
+
records.append(json.loads(line))
|
| 16 |
+
return Dataset.from_list(records)
|
| 17 |
+
|
| 18 |
+
def preprocess(example):
|
| 19 |
+
prompt = PROMPT_TEMPLATE.format(instruction=example.get('instruction',''), input=example.get('input',''))
|
| 20 |
+
example['prompt'] = prompt
|
| 21 |
+
example['response'] = example.get('output','')
|
| 22 |
+
return example
|
src/inference.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
from src.model import AllMAssistant
|
| 3 |
+
|
| 4 |
+
def main():
|
| 5 |
+
parser = argparse.ArgumentParser()
|
| 6 |
+
parser.add_argument('--model_dir', default='gpt2')
|
| 7 |
+
parser.add_argument('--prompt', default='Create a 10-minute beginner home workout for fat loss.')
|
| 8 |
+
parser.add_argument('--max_new_tokens', type=int, default=200)
|
| 9 |
+
args = parser.parse_args()
|
| 10 |
+
|
| 11 |
+
assistant = AllMAssistant(args.model_dir)
|
| 12 |
+
out = assistant.generate(args.prompt, max_new_tokens=args.max_new_tokens)
|
| 13 |
+
print(out)
|
| 14 |
+
|
| 15 |
+
if __name__ == '__main__':
|
| 16 |
+
main()
|
src/model.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
+
import torch
|
| 3 |
+
|
| 4 |
+
class AllMAssistant:
|
| 5 |
+
"""Lightweight wrapper for causal LMs used for inference in this project."""
|
| 6 |
+
def __init__(self, model_name_or_path: str, device: str = None):
|
| 7 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
| 8 |
+
if self.tokenizer.pad_token is None:
|
| 9 |
+
# ensure pad token exists
|
| 10 |
+
self.tokenizer.pad_token = self.tokenizer.eos_token
|
| 11 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_name_or_path)
|
| 12 |
+
self.device = device or ("cuda" if torch.cuda.is_available() else "cpu")
|
| 13 |
+
self.model.to(self.device)
|
| 14 |
+
|
| 15 |
+
def generate(self, prompt: str, max_new_tokens: int = 200, temperature: float = 0.7, top_p: float = 0.95):
|
| 16 |
+
inputs = self.tokenizer(prompt, return_tensors="pt", truncation=True, max_length=1024).to(self.device)
|
| 17 |
+
gen = self.model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=temperature, top_p=top_p)
|
| 18 |
+
return self.tokenizer.decode(gen[0], skip_special_tokens=True)
|
src/trainer.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import logging
|
| 3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, Trainer, TrainingArguments, DataCollatorForLanguageModeling
|
| 4 |
+
from src.dataset import load_jsonl, preprocess
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
logging.basicConfig(level=logging.INFO)
|
| 8 |
+
logger = logging.getLogger(__name__)
|
| 9 |
+
|
| 10 |
+
def make_prompts(example):
|
| 11 |
+
# concatenates prompt and response for causal LM training
|
| 12 |
+
return {'text': example['prompt'] + '\n' + example.get('response','') + '\n'}
|
| 13 |
+
|
| 14 |
+
def main():
|
| 15 |
+
parser = argparse.ArgumentParser()
|
| 16 |
+
parser.add_argument('--model_name_or_path', default='gpt2')
|
| 17 |
+
parser.add_argument('--train_file', default='data/train.jsonl')
|
| 18 |
+
parser.add_argument('--validation_file', default='data/val.jsonl')
|
| 19 |
+
parser.add_argument('--output_dir', default='outputs/allm')
|
| 20 |
+
parser.add_argument('--num_train_epochs', type=int, default=3)
|
| 21 |
+
parser.add_argument('--per_device_train_batch_size', type=int, default=2)
|
| 22 |
+
parser.add_argument('--learning_rate', type=float, default=5e-5)
|
| 23 |
+
args = parser.parse_args()
|
| 24 |
+
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path)
|
| 26 |
+
if tokenizer.pad_token is None:
|
| 27 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 28 |
+
|
| 29 |
+
model = AutoModelForCausalLM.from_pretrained(args.model_name_or_path)
|
| 30 |
+
|
| 31 |
+
train_ds = load_jsonl(args.train_file).map(preprocess)
|
| 32 |
+
val_ds = load_jsonl(args.validation_file).map(preprocess)
|
| 33 |
+
|
| 34 |
+
train_text = train_ds.map(make_prompts, remove_columns=train_ds.column_names)
|
| 35 |
+
val_text = val_ds.map(make_prompts, remove_columns=val_ds.column_names)
|
| 36 |
+
|
| 37 |
+
def tokenize(batch):
|
| 38 |
+
return tokenizer(batch['text'], truncation=True, padding='max_length', max_length=512)
|
| 39 |
+
|
| 40 |
+
train_tok = train_text.map(tokenize, batched=True, remove_columns=train_text.column_names)
|
| 41 |
+
val_tok = val_text.map(tokenize, batched=True, remove_columns=val_text.column_names)
|
| 42 |
+
|
| 43 |
+
data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False)
|
| 44 |
+
|
| 45 |
+
training_args = TrainingArguments(
|
| 46 |
+
output_dir=args.output_dir,
|
| 47 |
+
evaluation_strategy='epoch',
|
| 48 |
+
per_device_train_batch_size=args.per_device_train_batch_size,
|
| 49 |
+
per_device_eval_batch_size=args.per_device_train_batch_size,
|
| 50 |
+
num_train_epochs=args.num_train_epochs,
|
| 51 |
+
save_strategy='epoch',
|
| 52 |
+
learning_rate=args.learning_rate,
|
| 53 |
+
logging_steps=50,
|
| 54 |
+
remove_unused_columns=False
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
trainer = Trainer(
|
| 58 |
+
model=model,
|
| 59 |
+
args=training_args,
|
| 60 |
+
train_dataset=train_tok,
|
| 61 |
+
eval_dataset=val_tok,
|
| 62 |
+
data_collator=data_collator
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
trainer.train()
|
| 66 |
+
os.makedirs(args.output_dir, exist_ok=True)
|
| 67 |
+
trainer.save_model(args.output_dir)
|
| 68 |
+
tokenizer.save_pretrained(args.output_dir)
|
| 69 |
+
logger.info(f"Model saved to {args.output_dir}")
|
| 70 |
+
|
| 71 |
+
if __name__ == '__main__':
|
| 72 |
+
main()
|
src/utils.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def safe_truncate(s, max_len=1000):
|
| 2 |
+
if not isinstance(s, str):
|
| 3 |
+
s = str(s)
|
| 4 |
+
return s if len(s) <= max_len else s[:max_len-3] + '...'
|