CI/CD for Machine Learning
Ravi Bhadauria
Machine Learning Instructor
if
conditionjobs: hp_tune_and_publish_report: # Run when branch name starts with hp_tune/ if: startsWith(github.head_ref, 'hp_tune/')
steps: ... - name: | DVC pipeline for hyperparameter tuning run: dvc repro -f hp_tune
jobs: train_and_publish_report: # Run when branch name starts with train/ if: startsWith(github.head_ref, 'train/')
steps: ... - name: Run DVC pipeline for training run: dvc repro train
hp_tune/
steps: - name: Create training branch env: REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Branch name begins with train/ export BRANCH_NAME=train/$(git rev-parse --short "${{ github.sha }}")
# Create PR for training cml pr create \ --user-email [email protected] \ --user-name HPBot \ --message "Hyperparameter tuning" \ --branch $BRANCH_NAME \ --target-branch main \ rfc_best_params.json
GITHUB_TOKEN
cannot trigger workflows on self created PRs
Workarounds
steps:
- env:
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
-> git checkout train/1f34fs
-> git commit --amend --no-edit && git push -f
CI/CD for Machine Learning