Skip to content

Commit e4d73e6

Browse files
authored
Add transformers==4.54.0 to CI (#195)
* Add transformers==4.54.0 to CI * fix a couple of issues * issue * disable * fix issues * update ci * disable tests
1 parent 1f3d936 commit e4d73e6

File tree

7 files changed

+68
-20
lines changed

7 files changed

+68
-20
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,35 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest]
1818
python: ['3.10', '3.11', '3.12', '3.13']
19-
transformers: ['4.48.3', '4.51.3', '4.52.4', '4.53.3', 'main']
19+
transformers: ['4.48.3', '4.51.3', '4.52.4', '4.53.3', '4.54.0', 'main']
2020
torch: ['2.7', 'main']
2121
exclude:
2222
- python: '3.10'
2323
torch: 'main'
24-
- python: '3.11'
25-
torch: 'main'
24+
- python: '3.10'
25+
transformers: 'main'
2626
- python: '3.10'
2727
transformers: '4.52.4'
2828
- python: '3.10'
29-
transformers: 'main'
29+
transformers: '4.53.3'
30+
- python: '3.10'
31+
transformers: '4.54.0'
32+
- python: '3.11'
33+
torch: 'main'
3034
- python: '3.11'
3135
transformers: '4.53.3'
3236
- python: '3.11'
3337
transformers: 'main'
38+
- python: '3.11'
39+
transformers: '4.54.0'
3440
- python: '3.13'
3541
torch: '2.7'
3642
- python: '3.13'
3743
transformers: '4.48.3'
3844
- python: '3.13'
3945
transformers: '4.51.3'
46+
- python: '3.13'
47+
transformers: '4.52.4'
4048
steps:
4149
- uses: actions/checkout@v3
4250

@@ -121,8 +129,8 @@ jobs:
121129
pip install pytest
122130
PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests --ignore _unittests/ut_reference/test_backend_extended_reference_evaluator.py --ignore _unittests/ut_reference/test_backend_onnxruntime_evaluator.py --ignore _unittests/ut_torch_models/test_tiny_llms_bypassed.py --ignore _unittests/ut_tasks/test_tasks_zero_shot_image_classification.py --ignore _unittests/ut_tasks/test_tasks_image_classification.py
123131
124-
- name: run backend tests python
125-
run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_extended_reference_evaluator.py
132+
# - name: run backend tests python
133+
# run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_extended_reference_evaluator.py
126134

127-
- name: run backend tests onnxruntime
128-
run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_onnxruntime_evaluator.py --maxfail=15
135+
# - name: run backend tests onnxruntime
136+
# run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_onnxruntime_evaluator.py --maxfail=15

.github/workflows/documentation.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ jobs:
8585
pip install pytest pytest-cov
8686
PYTHONPATH=. UNITTEST_GOING=1 UNITTEST_DOT=1 pytest --cov=./onnx_diagnostic/ --cov-report=xml --durations=10 _unittests --ignore _unittests/ut_reference/test_backend_extended_reference_evaluator.py --ignore _unittests/ut_reference/test_backend_onnxruntime_evaluator.py --ignore _unittests/ut_torch_models/test_tiny_llms_bypassed.py
8787
88+
- name: run backend tests python
89+
run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_extended_reference_evaluator.py
90+
91+
- name: run backend tests onnxruntime
92+
run: PYTHONPATH=. UNITTEST_GOING=1 pytest --durations=10 _unittests/ut_reference/test_backend_onnxruntime_evaluator.py --maxfail=15
93+
8894
- name: Upload coverage reports to Codecov
8995
uses: codecov/codecov-action@v3
9096
env:

_unittests/ut_helpers/test_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def test_size_type_onnx(self):
333333
"FLOAT8E5M2",
334334
"FLOAT8E4M3FN",
335335
"FLOAT8E4M3FNUZ",
336+
"FLOAT8E8M0",
336337
}:
337338
onnx_dtype_to_torch_dtype(i)
338339
onnx_dtype_to_np_dtype(i)

_unittests/ut_reference/test_backend_extended_reference_evaluator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
238238
# The following tests fail due to a type mismatch.
239239
backend_test.exclude("(test_eyelike_without_dtype)")
240240

241+
if onnx_opset_version() <= 24:
242+
backend_test.exclude("(attention_3d|causal_expanded)")
243+
241244

242245
# import all test cases at global scope to make them visible to python.unittest
243246
globals().update(backend_test.test_cases)

_unittests/ut_reference/test_backend_onnxruntime_evaluator.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
231231
"|test_sub_uint8"
232232
"|test_thresholdedrelu"
233233
"|test_top_k_uint64"
234+
"|test_training"
234235
")"
235236
)
236237

@@ -242,6 +243,30 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
242243
")"
243244
)
244245

246+
if onnx_opset_version() <= 24:
247+
backend_test.exclude(
248+
"(deform_conv"
249+
"|gru"
250+
"|lstm"
251+
"|l1normalization"
252+
"|l2normalization"
253+
"|lpnormalization"
254+
"|maxunpool"
255+
"|attention_3d"
256+
"|causal_expanded"
257+
"|layer_normalization.*expanded"
258+
"|layer_normalization.*expanded"
259+
"|affine_grid.*expanded"
260+
"|test_rnn_seq"
261+
"|test_roialign_aligned_false"
262+
"|test_roialign_aligned_true"
263+
"|test_roialign_mode_max"
264+
"|test_simple_rnn_batchwise"
265+
"|test_simple_rnn_defaults"
266+
"|test_simple_rnn_with_initial_bias"
267+
")"
268+
)
269+
245270

246271
# import all test cases at global scope to make them visible to python.unittest
247272
globals().update(backend_test.test_cases)

onnx_diagnostic/helpers/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ def size_type(dtype: Any) -> int:
3636
TensorProto.FLOAT8E4M3FNUZ,
3737
TensorProto.FLOAT8E5M2,
3838
TensorProto.FLOAT8E5M2FNUZ,
39+
getattr(TensorProto, "FLOAT8E8M0", None),
3940
}:
4041
return 1
4142
if dtype in {TensorProto.COMPLEX128}:
4243
return 16
43-
from .helpers.onnx_helper import onnx_dtype_name
44+
from .onnx_helper import onnx_dtype_name
4445

4546
raise AssertionError(
4647
f"Unable to return the element size for type {onnx_dtype_name(dtype)}"

onnx_diagnostic/reference/ops/op_cast_like.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,26 @@
1111
float8e5m2fnuz,
1212
)
1313
except ImportError:
14+
bfloat16 = None
1415
from onnx.reference.ops.op_cast import cast_to
1516
from ...helpers.onnx_helper import np_dtype_to_tensor_dtype
1617

1718

1819
def _cast_like(x, y, saturate):
19-
if y.dtype == bfloat16 and y.dtype.descr[0][0] == "bfloat16":
20-
# np.uint16 == np.uint16 is True as well as np.uint16 == bfloat16
21-
to = TensorProto.BFLOAT16
22-
elif y.dtype == float8e4m3fn and y.dtype.descr[0][0] == "e4m3fn":
23-
to = TensorProto.FLOAT8E4M3FN
24-
elif y.dtype == float8e4m3fnuz and y.dtype.descr[0][0] == "e4m3fnuz":
25-
to = TensorProto.FLOAT8E4M3FNUZ
26-
elif y.dtype == float8e5m2 and y.dtype.descr[0][0] == "e5m2":
27-
to = TensorProto.FLOAT8E5M2
28-
elif y.dtype == float8e5m2fnuz and y.dtype.descr[0][0] == "e5m2fnuz":
29-
to = TensorProto.FLOAT8E5M2FNUZ
20+
if bfloat16 is not None:
21+
if y.dtype == bfloat16 and y.dtype.descr[0][0] == "bfloat16":
22+
# np.uint16 == np.uint16 is True as well as np.uint16 == bfloat16
23+
to = TensorProto.BFLOAT16
24+
elif y.dtype == float8e4m3fn and y.dtype.descr[0][0] == "e4m3fn":
25+
to = TensorProto.FLOAT8E4M3FN
26+
elif y.dtype == float8e4m3fnuz and y.dtype.descr[0][0] == "e4m3fnuz":
27+
to = TensorProto.FLOAT8E4M3FNUZ
28+
elif y.dtype == float8e5m2 and y.dtype.descr[0][0] == "e5m2":
29+
to = TensorProto.FLOAT8E5M2
30+
elif y.dtype == float8e5m2fnuz and y.dtype.descr[0][0] == "e5m2fnuz":
31+
to = TensorProto.FLOAT8E5M2FNUZ
32+
else:
33+
to = np_dtype_to_tensor_dtype(y.dtype) # type: ignore
3034
else:
3135
to = np_dtype_to_tensor_dtype(y.dtype) # type: ignore
3236
return (cast_to(x, to, saturate),)

0 commit comments

Comments
 (0)