Skip to content

Training Workflow

Training Workflow #71

name: Training Workflow
on:
workflow_dispatch:
inputs:
script_content:
description: 'Content of training script (Python or CUDA)'
required: true
type: string
script_type:
description: 'Script type (py or cu)'
required: true
type: choice
options:
- py
- cu
jobs:
train:
runs-on: ubuntu-latest
steps:
- name: Install Python dependencies
if: inputs.script_type == 'py'
run: |
pip install numpy
# Add other Python dependencies as needed
- name: Install CUDA dependencies
if: inputs.script_type == 'cu'
run: |
sudo apt-get update
sudo apt-get install -y nvidia-cuda-toolkit
nvcc --version
- name: Debug Step
if: inputs.script_type == 'cu'
run: |
echo "CUDA script detected"
cat << 'EOL' > train.${{ inputs.script_type }}
${{ inputs.script_content }}
EOL
cat train.${{ inputs.script_type }}
- name: Create training script
if : inputs.script_type == 'py' # TODO: remove later
run: |
echo '${{ inputs.script_content }}' > train.${{ inputs.script_type }}
cat train.${{ inputs.script_type }}
- name: Compile and run CUDA script
if: inputs.script_type == 'cu'
run: |
nvcc train.cu -o train_cuda
./train_cuda > training.log 2>&1
- name: Run Python script
if: inputs.script_type == 'py'
run: |
python train.py > training.log 2>&1
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: training-logs
path: training.log