Update train #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Train and Release Model | |
on: | |
push: | |
tags: | |
- "v*.*.*-model" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
train-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup_python | |
with: | |
python-version: "3.12" | |
- name: Restore cached venv | |
uses: actions/cache/restore@v4 | |
with: | |
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-ci-model.txt') }} | |
path: .venv | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
python -m pip install -r requirements-ci-model.txt | |
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH | |
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV | |
- name: Saved cached venv | |
uses: actions/cache/save@v4 | |
with: | |
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-ci-model.txt') }} | |
path: .venv | |
- name: Train | |
run: | | |
cd scripts | |
python train.py --epochs=1 --version $(echo "${{github.ref_name}}" | tr -d 'v\-model') | |
mv current_model.pth ../models/ | |
- name: Convert to ONNX | |
run: | | |
cd scripts | |
python convert_to_onnx.py | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
models/metadata.json | |
models/current_model.pth | |
models/current_model.onnx | |
draft: true |