Files
foxhunt/MAMBA2_POD_MONITOR.sh
jgrusewski 6da9d262db feat(ml): MAMBA-2 P0 fixes + hyperparameter optimization (13 params)
CRITICAL P0 FIXES (Validated - Loss 0.87 → 0.07):
- Add sigmoid activation to inference and training (ml/src/mamba/mod.rs:798, 1538)
- Fix config.total_decay_steps (was hardcoded 10000) (ml/src/mamba/mod.rs:2271)
- Update d_state: 16→64, 32→64 (Mamba-2 spec) (ml/src/mamba/mod.rs:178, 730)

HYPERPARAMETER OPTIMIZATION:
- Implement 13-parameter Bayesian optimization with argmin
- Add async data loading with 3-batch prefetch (+20-30% speedup)
- Create hyperopt adapter: ml/src/hyperopt/adapters/mamba2.rs
- Add example: ml/examples/hyperopt_mamba2_demo.rs

VALIDATION:
- Local test: Loss 0.07 vs 0.87 (12× improvement)
- Val loss: 0.04-0.14 vs 1.2 (27× improvement)
- Accuracy: 12-30% vs 1-5% (3-6× improvement)
- All binaries rebuilt and uploaded to Runpod S3

DEPLOYMENT:
- RTX 4090 pod active (n0fq2ikt4uk0zy)
- Training: 10 trials × 50 epochs, batch_size=256
- Expected: 1.3 days, $10.41 cost

Fixes #P0-sigmoid #P0-decay-steps #hyperopt-mamba2
2025-10-28 14:11:18 +01:00

170 lines
4.9 KiB
Bash
Executable File

#!/bin/bash
# MAMBA-2 Fixed Binary Deployment Monitor
# Pod ID: 8e6o2r2snavgzf
# Expected completion: 2025-10-27 10:21 UTC (~81 minutes from 09:00)
set -euo pipefail
POD_ID="8e6o2r2snavgzf"
CHECKPOINT_DIR="/runpod-volume/models/mamba2_FIXED_sgd_bs512_lr5e4_shuffle_50ep"
echo "=================================="
echo "MAMBA-2 FIXED BINARY MONITOR"
echo "=================================="
echo "Pod ID: $POD_ID"
echo "GPU: RTX 4090 (24GB VRAM)"
echo "Cost: \$0.59/hr"
echo "Expected runtime: ~81 minutes"
echo "=================================="
echo ""
# Load RunPod credentials
if [ ! -f ".env.runpod" ]; then
echo "ERROR: .env.runpod not found"
exit 1
fi
source .env.runpod
if [ -z "$RUNPOD_API_KEY" ]; then
echo "ERROR: RUNPOD_API_KEY not set"
exit 1
fi
# Function to check pod status
check_status() {
echo "Checking pod status..."
curl -s -H "Authorization: Bearer $RUNPOD_API_KEY" \
"https://rest.runpod.io/v1/pods/$POD_ID" | python3 -m json.tool
echo ""
}
# Function to download results
download_results() {
echo "Downloading results from S3..."
aws s3 sync "s3://se3zdnb5o4/models/mamba2_FIXED_sgd_bs512_lr5e4_shuffle_50ep" \
"./local_models/mamba2_FIXED" \
--profile runpod \
--endpoint-url https://s3api-eur-is-1.runpod.io
echo ""
echo "Results downloaded to ./local_models/mamba2_FIXED/"
ls -lh "./local_models/mamba2_FIXED/"
}
# Function to verify training success
verify_training() {
echo "Verifying training success..."
if [ ! -d "./local_models/mamba2_FIXED" ]; then
echo "ERROR: Results not downloaded yet. Run with 'download' first."
return 1
fi
# Check for model checkpoint
if [ -f "./local_models/mamba2_FIXED/mamba2_model_epoch_50.safetensors" ]; then
echo "✅ Model checkpoint found"
ls -lh "./local_models/mamba2_FIXED/mamba2_model_epoch_50.safetensors"
else
echo "❌ Model checkpoint NOT found"
fi
# Check for metrics
if [ -f "./local_models/mamba2_FIXED/training_metrics.json" ]; then
echo "✅ Training metrics found"
cat "./local_models/mamba2_FIXED/training_metrics.json"
else
echo "❌ Training metrics NOT found"
fi
# Check for loss history
if [ -f "./local_models/mamba2_FIXED/loss_history.csv" ]; then
echo "✅ Loss history found"
echo "Last 10 epochs:"
tail -n 10 "./local_models/mamba2_FIXED/loss_history.csv"
else
echo "❌ Loss history NOT found"
fi
# Check training log for key indicators
if [ -f "./local_models/mamba2_FIXED/training.log" ]; then
echo "✅ Training log found"
echo ""
echo "Checking for success indicators..."
# Check optimizer
if grep -q "Optimizer: SGD" "./local_models/mamba2_FIXED/training.log"; then
echo "✅ SGD optimizer confirmed (not Adam)"
else
echo "❌ SGD optimizer NOT found (check for Adam)"
fi
# Check for zero gradients
if grep -q "grad: 0.0000" "./local_models/mamba2_FIXED/training.log"; then
echo "❌ Zero gradients detected (P0 fix failed)"
else
echo "✅ No zero gradients detected"
fi
# Check for E11 spike
if grep -q "E11" "./local_models/mamba2_FIXED/training.log" || \
grep -q "1e+11" "./local_models/mamba2_FIXED/training.log"; then
echo "❌ E11 spike detected (numerical instability)"
else
echo "✅ No E11 spike detected"
fi
else
echo "❌ Training log NOT found"
fi
}
# Main menu
case "${1:-status}" in
status)
check_status
;;
download)
download_results
;;
verify)
verify_training
;;
ssh)
echo "SSH to pod $POD_ID..."
echo "ssh root@$POD_ID.ssh.runpod.io"
echo ""
echo "Once connected, check training status:"
echo " cd $CHECKPOINT_DIR"
echo " tail -f training.log"
;;
jupyter)
echo "Jupyter URL: https://$POD_ID-8888.proxy.runpod.net"
echo ""
echo "Navigate to: $CHECKPOINT_DIR/training.log"
;;
all)
check_status
echo ""
echo "=================================="
read -p "Download results? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
download_results
echo ""
verify_training
fi
;;
*)
echo "Usage: $0 {status|download|verify|ssh|jupyter|all}"
echo ""
echo "Commands:"
echo " status - Check pod status via API"
echo " download - Download results from S3"
echo " verify - Verify training success (requires download first)"
echo " ssh - Show SSH command"
echo " jupyter - Show Jupyter URL"
echo " all - Status + download + verify (interactive)"
exit 1
;;
esac