Skip to content

Training Workflow

Training Workflow #47

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: Cache PyTorch
uses: actions/cache@v3
with:
path: |
~/.cache/pip
${{ runner.tool_cache }}/Python
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install numpy torch
- name: Create and run training script
run: |
echo "${{ inputs.script_content }}" > train.py
cat train.py # Debug: print the content
python train.py > training.log 2>&1
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: training-logs
path: training.log