-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.59 KB
/
publish-model.yml
File metadata and controls
61 lines (52 loc) · 1.59 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
name: Publish Model
on:
push:
tags:
- 'model/v*.*.*'
defaults:
run:
shell: bash
jobs:
train-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
id: setup_python
with:
python-version: '3.12'
- name: Restore cached venv
uses: actions/cache/restore@v5
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@v5
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 --version $(echo "${{github.ref_name}}" | tr -d 'model/v')
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
scripts/train_log.txt
draft: true