Skip to content

Commit b99ccbf

Browse files
authored
patch doc, fix torch_deepcopy for empty DynamicCache and transformers==5.1.0 (#408)
* patch doc * update CI for 5.1.0 * fix version * fix dynamiccache * fix unt * fix for 5.2.0 * fix ut * fix documentation
1 parent 20ace19 commit b99ccbf

15 files changed

Lines changed: 88 additions & 18 deletions

File tree

.github/workflows/check-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest, macOS-latest, windows-latest]
1818
python: ['3.13']
19-
transformers: ['5.0', 'main']
19+
transformers: ['5.1.0', 'main']
2020
torch: ['2.10', 'main']
2121

2222
steps:

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
os: [ubuntu-latest]
1919
python: ['3.10', '3.11', '3.12', '3.13']
20-
transformers: ['4.48.3', '4.51.3', '4.55.4', '4.57.6', '5.0', 'main']
20+
transformers: ['4.48.3', '4.51.3', '4.55.4', '4.57.6', '5.1.0', 'main']
2121
torch: ['2.10', 'main']
2222
exclude:
2323
# 3.10 - torch
@@ -29,7 +29,7 @@ jobs:
2929
- python: '3.10'
3030
transformers: '4.57.6'
3131
- python: '3.10'
32-
transformers: '5.0'
32+
transformers: '5.1.0'
3333
- python: '3.10'
3434
transformers: 'main'
3535
# 3.11 - torch
@@ -41,7 +41,7 @@ jobs:
4141
- python: '3.11'
4242
transformers: '4.57.6'
4343
- python: '3.11'
44-
transformers: '5.0'
44+
transformers: '5.1.0'
4545
- python: '3.11'
4646
transformers: 'main'
4747
# 3.13 - torch

CHANGELOGS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Change Logs
44
0.9.1
55
+++++
66

7+
* :pr:`408`: fix torch_deepcopy for empty DynamicCache and transformers==5.1.0, 5.2.0 (see https://github.com/huggingface/transformers/pull/43765/)
8+
79
0.9.0
810
+++++
911

_doc/status/patches_diff.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,21 @@ Those two versions leads to the following list of patches.
6161
patch_details=details,
6262
):
6363
pass
64+
done = set()
6465
for patch in details.patched:
65-
print(f"* {patch.family} - {getattr(patch.function_to_patch, '__name__', patch.function_to_patch)}")
66+
if patch.function_to_patch == patch.patch:
67+
continue
68+
if patch.refid in done:
69+
continue
70+
done.add(patch.refid)
71+
print(f"* :ref:`{patch.refid}`")
6672
print()
6773
print()
74+
done = set()
6875
for patch in details.patched:
76+
if patch.refid in done:
77+
continue
78+
done.add(patch.refid)
6979
if patch.function_to_patch == patch.patch:
7080
continue
7181
rst = patch.format_diff(format="rst")

_scripts/test_backend_onnxruntime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
141141

142142
backend_test.exclude("(test_adagrad|test_adam|test_add_uint8)")
143143

144-
if pv.Version(onnxruntime.__version__) <= pv.Version("1.24"):
144+
if pv.Version(onnxruntime.__version__) <= pv.Version("1.25"):
145145
backend_test.exclude("(test_attention_4d_with|test_attention_4d_gqa)")
146146

147147

_unittests/ut_reference/test_backend_onnxruntime_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def run_node(cls, node, inputs, device=None, outputs_info=None, **kwargs):
299299
)
300300

301301

302-
if pv.Version(onnxruntime.__version__) <= pv.Version("1.24"):
302+
if pv.Version(onnxruntime.__version__) <= pv.Version("1.25"):
303303
backend_test.exclude("(test_attention_4d_with|test_attention_4d_gqa)")
304304

305305
# import all test cases at global scope to make them visible to python.unittest

_unittests/ut_tasks/test_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def test_falcon_mamba_dev(self):
266266
model(**inputs)
267267
model(**data["inputs2"])
268268
self.assertIn((data["size"], data["n_weights"]), [(274958336, 68739584)])
269-
if not has_transformers("5.0.99"):
269+
if not has_transformers("5.2.99"):
270270
raise unittest.SkipTest("The model has control flow.")
271271
with torch_export_patches(patch_transformers=True, verbose=10, stop_if_static=1):
272272
torch.export.export(

_unittests/ut_tasks/test_tasks_image_text_to_text.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class TestTasksImageTextToText(ExtTestCase):
1717
@hide_stdout()
18-
@requires_transformers("5.0.99")
18+
@requires_transformers("5.2.99")
1919
@requires_torch("2.7.99")
2020
def test_image_text_to_text_idefics(self):
2121
mid = "HuggingFaceM4/tiny-random-idefics"
@@ -32,7 +32,7 @@ def test_image_text_to_text_idefics(self):
3232
self.assertEqualAny(expected, ep.module()(**inputs), atol=1)
3333

3434
@hide_stdout()
35-
@requires_transformers("5.0.99")
35+
@requires_transformers("5.2.99")
3636
@requires_torch("2.7.99")
3737
def test_image_text_to_text_tiny_gemma3(self):
3838
"""
@@ -88,7 +88,7 @@ def test_image_text_to_text_gemma3_4b_it(self):
8888
self.assertEqualAny(expected, ep.module()(**inputs))
8989

9090
@hide_stdout()
91-
@requires_transformers("5.0.99")
91+
@requires_transformers("5.2.99")
9292
@requires_torch("2.7.99")
9393
def test_image_text_to_text_zai_glm(self):
9494
"""

_unittests/ut_torch_export_patches/test_patch_transformers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def test_plug_multi_head_attention_qwen25_packed_float16(self):
703703
self.assertEqualArray(results.eager_outputs[0], results.onnx_outputs[0], atol=0.01)
704704
self.assertLess(results.diffs[0]["abs"], 0.01)
705705

706-
@requires_onnxruntime("1.24")
706+
@requires_onnxruntime("1.25")
707707
@unittest.skipIf(not patch_qwen2_5, "Qwen25 not part of this transformers")
708708
def test_plug_multi_head_attention_qwen25_loopmha_float16(self):
709709
from onnx_diagnostic.torch_export_patches.patches._patch_transformers_qwen2_5 import (
@@ -738,7 +738,7 @@ def test_plug_multi_head_attention_qwen25_loopmha_float16(self):
738738
self.assertEqualArray(results.eager_outputs[0], results.onnx_outputs[0], atol=0.01)
739739
self.assertLess(results.diffs[0]["abs"], 0.01)
740740

741-
@requires_onnxruntime("1.24")
741+
@requires_onnxruntime("1.25")
742742
@unittest.skipIf(not patch_qwen2_5, "Qwen25 not part of this transformers")
743743
def test_plug_multi_head_attention_qwen25_loopmha_float32(self):
744744
from onnx_diagnostic.torch_export_patches.patches._patch_transformers_qwen2_5 import (
@@ -773,7 +773,7 @@ def test_plug_multi_head_attention_qwen25_loopmha_float32(self):
773773
self.assertEqualArray(results.eager_outputs[0], results.onnx_outputs[0], atol=1e-5)
774774
self.assertLess(results.diffs[0]["abs"], 1e-5)
775775

776-
@requires_onnxruntime("1.24")
776+
@requires_onnxruntime("1.25")
777777
@unittest.skipIf(not patch_qwen2_5, "Qwen25 not part of this transformers")
778778
def test_plug_multi_head_attention_qwen25_loopa24_float16(self):
779779
from onnx_diagnostic.torch_export_patches.patches._patch_transformers_qwen2_5 import (
@@ -801,7 +801,7 @@ def test_plug_multi_head_attention_qwen25_loopa24_float16(self):
801801
self.assertEqualArray(results.eager_outputs[0], results.onnx_outputs[0], atol=0.005)
802802
self.assertLess(results.diffs[0]["abs"], 0.005)
803803

804-
@requires_onnxruntime("1.24")
804+
@requires_onnxruntime("1.25")
805805
@unittest.skipIf(not patch_qwen2_5, "Qwen25 not part of this transformers")
806806
def test_plug_multi_head_attention_qwen25_loopa24_float32(self):
807807
from onnx_diagnostic.torch_export_patches.patches._patch_transformers_qwen2_5 import (

_unittests/ut_torch_onnx/test_discrepancies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def qwen_sdpa_attention(
4646
return attn_output
4747

4848
for model_name in ["attention_loopa24.onnx", "attention_loopmha.onnx"]:
49-
if model_name == "attention_loopa24.onnx" and not has_onnxruntime("1.24"):
49+
if model_name == "attention_loopa24.onnx" and not has_onnxruntime("1.25"):
5050
# not available
5151
continue
5252
with self.subTest(model=model_name):

0 commit comments

Comments
 (0)