Skip to content

Commit

Permalink
Merge pull request #21 from gpu-mode/triton_check
Browse files Browse the repository at this point in the history
Re-order write to train.py and install accordingly
  • Loading branch information
alexzhang13 authored Nov 13, 2024
2 parents d9eb39f + bb29bc5 commit 1c4f2ed
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/train_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,29 @@ jobs:
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: Install dependencies
run: |
if grep -rE "(import numpy|from numpy)" train.py; then
echo "Numpy detected, installing numpy"
pip install numpy
fi
# Check if 'import torch' is in any Python file
if grep -rE "(import torch|from torch)" train.py; then
echo "PyTorch detected, installing torch"
pip install torch
fi
# Check if 'import triton' is in any Python file
if grep -rE "(import triton|from triton)" train.py; then
echo "Triton detected, installing triton"
pip install triton
fi
- name: Run training script
run: |
python train.py > training.log 2>&1
Expand Down

0 comments on commit 1c4f2ed

Please sign in to comment.