-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_script.sh
More file actions
executable file
·44 lines (35 loc) · 1015 Bytes
/
train_script.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Model training script
# Runs every 3 days via cron to train new model with last 14 days of data
set -e
# Get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Load environment variables from .env if exists
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
# Create virtualenv if it doesn't exist
if [ ! -d ".venv" ]; then
echo "Creating virtual environment..."
python -m venv .venv
fi
# Activate virtualenv
if [ -d ".venv" ]; then
source .venv/bin/activate
elif [ -d "venv" ]; then
source venv/bin/activate
else
echo "ERROR: No virtualenv found"
exit 1
fi
# Install dependencies
pip install -q -e .
# Run training pipeline
echo "========================================"
echo "Starting model training..."
echo "========================================"
python -m src.training.train "$@"
echo "========================================"
echo "Training complete!"
echo "========================================"