Training Workflow #105
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: NVIDIA PyTorch Job | |
on: | |
workflow_dispatch: | |
inputs: | |
script_content: | |
description: 'Content of train.py' | |
required: true | |
type: string | |
jobs: | |
train: | |
runs-on: [gpumode-nvidia-arc] | |
container: | |
image: nvidia/cuda:12.4.0-devel-ubuntu22.04 | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install numpy | |
pip install torch | |
- name: Create training script | |
shell: python | |
run: | | |
with open('train.py', 'w') as f: | |
f.write('''${{ github.event.inputs.script_content }}''') | |
- name: Run training script | |
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 | |
env: | |
CUDA_VISIBLE_DEVICES: 0 # Make sure only one GPU is used for testing |