@@ -586,7 +586,7 @@ def forward(
586586 for exporter in ("custom" , "onnx-dynamo" ):
587587 # onnx-dynamo needs OpOverload(op='aten.sym_storage_offset' (transformers>=5.0?)
588588 if exporter == "onnx-dynamo" and not has_onnxscript ("0.5.7" ):
589- raise unittest . SkipTest ("needs onnxscript>=0.5.7" )
589+ self . skipTest ("needs onnxscript>=0.5.7" )
590590 filename = self .get_dump_file (
591591 f"test_patched_qwen2_5_vl_vision_attention_forward.{ exporter } .onnx"
592592 )
@@ -640,7 +640,7 @@ def test_qwen2_5_vl_vision_attention_iteration(self):
640640 )
641641 for exporter in ("custom" , "onnx-dynamo" ):
642642 if exporter == "onnx-dynamo" and aten_sym_storage_offset is None :
643- raise unittest . SkipTest ("update onnxscript to make this test run" )
643+ self . skipTest ("update onnxscript to make this test run" )
644644 # onnx-dynamo needs OpOverload(op='aten.sym_storage_offset' (transformers>=5.0?)
645645 filename = self .get_dump_file (
646646 f"test_qwen2_5_vl_vision_attention_iteration.{ exporter } .onnx"
@@ -909,7 +909,7 @@ def test_cache_dependant_input_preparation_exporting(self):
909909 torch .testing .assert_close (eager2 , export2 )
910910
911911 with self .subTest (case = "case2" ):
912- raise unittest . SkipTest ("torch 2.10+ has probably a bug here." )
912+ self . skipTest ("torch 2.10+ has probably a bug here." )
913913 input_ids = torch .randint (0 , 16 , (2 , 8 ), dtype = torch .int64 )
914914 inputs_embeds = torch .rand ((2 , 8 ), dtype = torch .float32 )
915915 cache_position = torch .arange (0 , 8 , dtype = torch .int64 )
@@ -995,15 +995,17 @@ def test_prepare_inputs_for_generation_decoder_llm(self):
995995
996996 with self .subTest (case = "case5" ):
997997 if not has_transformers ("4.57" ):
998- raise unittest . SkipTest ( "transformers 4.57+ ." )
998+ self . skipTest ( "This test only works with transformers>= 4.57, <5.3 ." )
999999 if has_transformers ("5.2.99" ):
1000- raise unittest . SkipTest ( "transformers 5.2+ ." )
1000+ self . skipTest ( "This test is no longer valid with transformers>=5.3 ." )
10011001 with self .assertRaises ((AttributeError , TypeError )):
10021002 model_inputs = model .prepare_inputs_for_generation (
10031003 input_ids , past_key_values = dynamic_cache
10041004 )
10051005
10061006 with self .subTest (case = "case6" ):
1007+ if has_transformers ("5.2.99" ):
1008+ self .skipTest ("This test is no longer valid with transformers>=5.3." )
10071009 cache_position = torch .arange (input_ids .shape [- 1 ], dtype = torch .long ).to (
10081010 torch_device
10091011 )
@@ -1025,6 +1027,8 @@ def test_prepare_inputs_for_generation_decoder_llm(self):
10251027 ) # we still need the full attention mask!
10261028
10271029 with self .subTest (case = "case6.2" ):
1030+ if has_transformers ("5.2.99" ):
1031+ self .skipTest ("This test is no longer valid with transformers>=5.3." )
10281032 max_cache_len = 10
10291033 batch_size = 2
10301034 query_length = input_ids .shape [- 1 ] - init_input_ids .shape [- 1 ]
@@ -1048,7 +1052,7 @@ def test_prepare_inputs_for_generation_decoder_llm(self):
10481052
10491053 with self .subTest (case = "case7" ):
10501054 if not has_transformers ("4.57" ):
1051- raise unittest . SkipTest ( "transformers 4.57+ ." )
1055+ self . skipTest ( "This test only works with transformers>= 4.57." )
10521056 init_inputs_embeds = model .get_input_embeddings ()(init_input_ids )
10531057 model_inputs = model .prepare_inputs_for_generation (
10541058 input_ids ,
0 commit comments