Training Workflow #138
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: 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: [gpumode-nvidia-arc] | |
container: | |
image: nvidia/cuda:12.4.0-devel-ubuntu22.04 | |
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: Create training script | |
run: | | |
cat << 'EOL' > train.${{ inputs.script_type }} | |
${{ inputs.script_content }} | |
EOL | |
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 |