50
50
DisableScratchPages : ${{ inputs.driver == 'rolling' && '1' || '0' }}
51
51
python : ${{ inputs.python != '' && inputs.python || '3.10' }}
52
52
pytorch : ${{ inputs.pytorch != '' && inputs.pytorch || 'nightly' }}
53
+ transformers : ${{ inputs.transformers != '' && inputs.transformers || 'v4.47.0' }}
53
54
TRANSFORMERS_TEST_DEVICE_SPEC : ' spec.py'
54
55
steps :
55
56
- name : Checkout torch-xpu-ops
60
61
uses : actions/checkout@v4
61
62
with :
62
63
repository : huggingface/transformers
63
- ref : ${{ inputs .transformers != '' && inputs.transformers || 'v4.47.0' }}
64
+ ref : ${{ env .transformers }}
64
65
path : transformers
65
66
- name : Prepare OS environment
66
67
run : |
@@ -103,13 +104,12 @@ jobs:
103
104
rm -rf reports
104
105
cp ${{ github.workspace }}/torch-xpu-ops/.github/scripts/spec.py ./
105
106
- name : Report installed versions
106
- id : installed
107
107
run : |
108
108
source activate huggingface_transformers_test
109
- echo "TORCH_BRANCH_ID=$(python -c 'import torch; print(torch.__version__)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}"
110
- echo "TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}"
111
109
echo "pip installed packages:"
112
110
pip list | tee ${{ github.workspace }}/transformers/tests_log/pip_list.txt
111
+ echo "lspci gpu devices:"
112
+ lspci -d ::0380 | tee ${{ github.workspace }}/transformers/tests_log/lspci_0380.txt
113
113
echo "GPU render nodes:"
114
114
cat /sys/class/drm/render*/device/device | tee ${{ github.workspace }}/transformers/tests_log/device_IDs.txt
115
115
- name : Sanitry check installed packages
@@ -120,11 +120,133 @@ jobs:
120
120
pip show torch | grep Version | grep xpu
121
121
pip show torchaudio | grep Version | grep xpu
122
122
pip show torchvision | grep Version | grep xpu
123
- - name : Run XPU backbone
123
+ python -c 'import torch; exit(not torch.xpu.is_available())'
124
+ - name : Run -k backbone tests
124
125
run : |
125
126
source activate huggingface_transformers_test
126
127
cd transformers
127
- python3 -m pytest -rsf --make-reports=tests_benchmark -k backbone tests
128
+ python3 -m pytest -rsf --make-reports=tests_backbone -k backbone tests
129
+ - name : Run tests/pipelines
130
+ run : |
131
+ source activate huggingface_transformers_test
132
+ cd transformers
133
+ # Some tests are known to fail w/o clear pattern
134
+ # TODO: drop ||true after triage and fixes
135
+ python3 -m pytest -rsf --make-reports=tests_pipelines tests/pipelines || true
136
+ - name : Run tests/trainer
137
+ run : |
138
+ source activate huggingface_transformers_test
139
+ cd transformers
140
+ # Excluding tests due to:
141
+ # * Some ray tests hang, reason unknown
142
+ # * torch.distributed.* not yet supported by XPU
143
+ pattern=" \
144
+ not ray and \
145
+ not TestTrainerDistributed and \
146
+ not TestTrainerDistributedXPU and \
147
+ not TestFSDPTrainer"
148
+ python3 -m pytest -rsf --make-reports=tests_trainer tests/trainer -k "$pattern"
149
+ - name : Print results table
150
+ if : ${{ ! cancelled() }}
151
+ run : |
152
+ # Helper function to return number preceeding given pattern, i.e:
153
+ # === 25 failed, 11 warnings, 0 errors ===
154
+ # Call as follows:
155
+ # parse_stat $line "failed"
156
+ function parse_stat() {
157
+ stat=$(cat $1 | grep $2 | sed "s/.* \([0-9]*\) $2.*/\1/")
158
+ if [ -n "$stat" ]; then echo $stat; else echo "0"; fi
159
+ }
160
+ cd transformers
161
+ {
162
+ echo "### Results"
163
+ echo "| Test group | Errors | Failed | Passed | Skipped |"
164
+ echo "| --- | --- | --- | --- | --- |"
165
+ for stat in $(find reports -name stats.txt); do
166
+ # Each stat.txt is located in: reports/$test_group/stats.txt
167
+ test_group=$(echo $stat | cut -f 2 -d/)
168
+ # Get failed, passed, skipped, etc. counters
169
+ failed=$(parse_stat $stat failed)
170
+ passed=$(parse_stat $stat passed)
171
+ skipped=$(parse_stat $stat skipped)
172
+ warnings=$(parse_stat $stat warnings)
173
+ errors=$(parse_stat $stat errors)
174
+ echo "| $test_group | $errors | $failed | $passed | $skipped |"
175
+ done
176
+ } >> $GITHUB_STEP_SUMMARY
177
+ - name : Print failure lines
178
+ if : ${{ ! cancelled() }}
179
+ run : |
180
+ cd transformers
181
+ {
182
+ echo "### Failure lines"
183
+ echo "| File | Error | Comment |"
184
+ echo "| --- | --- | --- |"
185
+ rm -rf _failures.txt
186
+ for failure in $(find reports -name failures_line.txt); do
187
+ tail -n +2 $failure >> _failures.txt
188
+ done
189
+ # failures_line.txt file does not have test case information,
190
+ # so we can just sort the output and report uniq values
191
+ sort _failures.txt | uniq > _failures_uniq.txt
192
+ while read line; do
193
+ file=$(echo $line | cut -f1 -d" " | sed "s/\(.*\):$/\1/")
194
+ error=$(echo $line | cut -f2 -d" " | sed "s/\(.*\):$/\1/")
195
+ # Failure comments often contain special characters which complicate
196
+ # parsing failure lines. But fortunately we know for sure where comments
197
+ # start. So we just output all contents starting from this position and
198
+ # wrap everything in <pre></pre> to avoid collisions with Markdown formatting.
199
+ comment="<pre>$(echo $line | cut -f3- -d' ' | sed 's/\(.*\):$/\1/')</pre>"
200
+ echo "| $file | $error | $comment |"
201
+ done <_failures_uniq.txt
202
+ } >> $GITHUB_STEP_SUMMARY
203
+ - name : Print annotations
204
+ if : ${{ ! cancelled() }}
205
+ run : |
206
+ source activate huggingface_transformers_test
207
+ {
208
+ echo "### Annotations"
209
+ echo "| | |"
210
+ echo "| --- | --- |"
211
+ echo "| jobs.$GITHUB_JOB.versions.os | $(source /etc/os-release && echo $VERSION_ID) |"
212
+ echo "| jobs.$GITHUB_JOB.versions.linux-kernel | $(uname -r) |"
213
+ echo "| jobs.$GITHUB_JOB.versions.python | $(python --version | cut -f2 -d' ') |"
214
+ packages=" \
215
+ level-zero \
216
+ libigc1 \
217
+ libigc2 \
218
+ libze1 \
219
+ libze-intel-gpu1 \
220
+ intel-i915-dkms \
221
+ intel-level-zero-gpu \
222
+ intel-opencl-icd"
223
+ for package in $packages; do
224
+ package_version=$(dpkg -l | grep $package | grep ii | head -1 | sed "s/ */ /g" | cut -f3 -d" ")
225
+ echo "| jobs.$GITHUB_JOB.versions.$package | $package_version |"
226
+ done
227
+ packages="accelerate \
228
+ numpy \
229
+ torch \
230
+ torchaudio \
231
+ torchvision \
232
+ transformers"
233
+ for package in $packages; do
234
+ package_version=$(python -c "import $package; print($package.__version__)" || true)
235
+ echo "| jobs.$GITHUB_JOB.versions.$package | $package_version |"
236
+ done
237
+ # printing annotations for GPU cards
238
+ var="[$(cat /sys/class/drm/render*/device/vendor || true)]"
239
+ echo "| jobs.$GITHUB_JOB.drm.render_nodes_vendor_ids | $(echo $var | sed 's/ /,/g') |"
240
+ var="[$(cat /sys/class/drm/render*/device/device || true)]"
241
+ echo "| jobs.$GITHUB_JOB.drm.render_nodes_device_ids | $(echo $var | sed 's/ /,/g') |"
242
+ var=$(python -c "import torch; print(torch.version.xpu)" || true)
243
+ echo "| jobs.$GITHUB_JOB.torch.version.xpu | $var |"
244
+ var=$(python -c "import torch; print(torch.xpu.device_count())" || true)
245
+ echo "| jobs.$GITHUB_JOB.torch.xpu.device_count | $var |"
246
+ # printing annotations with key environment variables
247
+ echo "| jobs.$GITHUB_JOB.env.ZE_AFFINITY_MASK | $ZE_AFFINITY_MASK |"
248
+ echo "| jobs.$GITHUB_JOB.env.NEOReadDebugKeys | $NEOReadDebugKeys |"
249
+ } >> $GITHUB_STEP_SUMMARY
128
250
- name : Upload Test log
129
251
if : ${{ ! cancelled() }}
130
252
uses : actions/upload-artifact@v4
0 commit comments