-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (55 loc) · 1.47 KB
/
train_workflow.yml
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
name: Training Workflow
on:
workflow_dispatch:
inputs:
script_content:
description: 'Content of train.py'
required: true
type: string
jobs:
train:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v1
- name: Cache UV packages
uses: actions/cache@v3
with:
path: |
~/.cache/uv
.venv
key: ${{ runner.os }}-uv-numpy-torch-v2
restore-keys: |
${{ runner.os }}-uv-numpy-torch-
- name: Create virtual environment and install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install numpy torch
- name: Create and run training script
run: |
echo "${{ inputs.script_content }}" > train.py
source .venv/bin/activate
python train.py > training.log 2>&1
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: training-logs
path: training.log
retention-days: 1
if-no-files-found: warn
cleanup:
runs-on: ubuntu-latest
needs: train
if: always()
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: training-logs