Repository navigation
Expand file tree
/
Copy pathhyperparameter-optimization.yml
More file actions
109 lines (103 loc) · 3.69 KB
/
Copy pathhyperparameter-optimization.yml
File metadata and controls
109 lines (103 loc) · 3.69 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Hyperparameter Optimization
permissions:
contents: read
concurrency:
group: f1-generated-artifact-writes
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
method:
description: 'Optimization method'
type: choice
options:
- grid_search
- bayesian
- both
default: bayesian
n_trials:
description: 'Number of Optuna trials (bayesian only)'
type: number
default: 100
schedule:
- cron: '0 2 1 3,6,9,12 *' # 1st of Mar, Jun, Sep, Dec at 2 AM UTC
jobs:
grid-search:
if: ${{ inputs.method == 'grid_search' || inputs.method == 'both' || github.event_name == 'schedule' }}
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements-training.txt
- name: Run Grid Search
run: python scripts/precompute/hyperparameter_grid_search.py --output data_files/precomputed/hyperparam_grid.json
env:
STREAMLIT_SERVER_HEADLESS: '1'
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: grid-search-results
path: data_files/precomputed/hyperparam_grid.json
bayesian-optimization:
if: ${{ inputs.method == 'bayesian' || inputs.method == 'both' || github.event_name == 'schedule' }}
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements-training.txt
- name: Run Bayesian Optimization
run: |
python scripts/precompute/hyperparameter_bayesian.py \
--n-trials ${{ inputs.n_trials || 100 }} \
--output data_files/precomputed/hyperparam_bayesian.json
env:
STREAMLIT_SERVER_HEADLESS: '1'
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: bayesian-results
path: data_files/precomputed/hyperparam_bayesian.json
commit-results:
needs: [grid-search, bayesian-optimization]
if: always()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
path: data_files/precomputed/
merge-multiple: true
- name: Show git status at start
run: |
echo "Job started at $(date -u)"
git status
git log -1 --oneline
git pull --ff-only origin main || true
- name: Commit hyperparameter results
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull --ff-only origin main || true
git add data_files/precomputed/
if git diff --staged --quiet; then
echo "No changes"
else
git commit -m "chore: update hyperparameter optimization results [skip ci]"
git push
fi
- name: Show post-push status
if: success()
run: |
echo "Job finished at $(date -u)"
git log -1 --oneline
git remote show origin | grep "HEAD branch" -A1