-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
77 lines (69 loc) · 2.19 KB
/
Copy pathaction.yml
File metadata and controls
77 lines (69 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: torch-preflight
description: Catch PyTorch VRAM leaks and silent convergence bugs, and check a training run fits before it starts.
author: Himanshu Janbandhu
branding:
icon: shield
color: orange
inputs:
paths:
description: Files or directories to check.
required: false
default: "."
format:
description: Output format - terminal, json, github (inline PR annotations) or sarif.
required: false
default: github
output:
description: Write the report to this file instead of stdout (use with format:sarif).
required: false
default: ""
fail-on:
description: Minimum severity that fails the job - error, warning or note.
required: false
default: error
select:
description: Comma-separated rule codes to run exclusively.
required: false
default: ""
ignore:
description: Comma-separated rule codes to skip.
required: false
default: ""
version:
description: Version specifier for the pip install, e.g. "==0.1.0".
required: false
default: ""
python-version:
description: Python version used to run torch-preflight.
required: false
default: "3.11"
outputs:
exit-code:
description: 0 when clean, 1 when findings reached the fail-on threshold.
value: ${{ steps.run.outputs.exit-code }}
runs:
using: composite
steps:
- uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
- name: Install torch-preflight
shell: bash
run: python -m pip install --disable-pip-version-check "torch-preflight${{ inputs.version }}"
- name: Run torch-preflight
id: run
shell: bash
run: |
args=(check ${{ inputs.paths }} --format "${{ inputs.format }}" --fail-on "${{ inputs.fail-on }}")
[ -n "${{ inputs.select }}" ] && args+=(--select "${{ inputs.select }}")
[ -n "${{ inputs.ignore }}" ] && args+=(--ignore "${{ inputs.ignore }}")
set +e
if [ -n "${{ inputs.output }}" ]; then
torch-preflight "${args[@]}" > "${{ inputs.output }}"
else
torch-preflight "${args[@]}"
fi
code=$?
set -e
echo "exit-code=$code" >> "$GITHUB_OUTPUT"
exit $code