@@ -126,27 +126,29 @@ def _config_reduction(config, task):
126126 print (f"-- processor={ type (processor )} " )
127127 print (f"-- PROCESSOR LOADED IN { time .perf_counter () - begin } " )
128128
129- big_inputs = dict (
130- hidden_states = torch .rand ((14308 , 1176 ), dtype = torch_dtype ).to (device ),
131- grid_thw = torch .tensor ([[1 , 98 , 146 ]], dtype = torch .int64 ).to (device ),
132- )
133- print ("-- save inputs" )
134129 inputs = dict (
135130 hidden_states = torch .rand ((1292 , 1176 ), dtype = torch_dtype ).to (device ),
136131 grid_thw = torch .tensor ([[1 , 34 , 38 ]], dtype = torch .int64 ).to (device ),
137132 )
138133 if not self .unit_test_going ():
134+ print ("-- save inputs" )
135+ torch .save (inputs , self .get_dump_file ("qwen25_vli_visual.inputs.pt" ))
139136 print ("-- save big inputs" )
137+ big_inputs = dict (
138+ hidden_states = torch .rand ((14308 , 1176 ), dtype = torch_dtype ).to (device ),
139+ grid_thw = torch .tensor ([[1 , 98 , 146 ]], dtype = torch .int64 ).to (device ),
140+ )
140141 torch .save (big_inputs , self .get_dump_file ("qwen25_vli_visual.inputs.big.pt" ))
141- torch .save (inputs , self .get_dump_file ("qwen25_vli_visual.inputs.pt" ))
142+ else :
143+ big_inputs = None
142144
143145 print (f"-- inputs: { self .string_type (inputs , with_shape = True )} " )
144146 # this is too long
145147 model_to_export = model .visual if hasattr (model , "visual" ) else model .model .visual
146148 begin = time .perf_counter ()
147149 if not os .environ .get ("STOPAT" , "" ):
148150 expected = model_to_export (** inputs )
149- expected_big = model_to_export (** big_inputs )
151+ expected_big = None if big_inputs is None else model_to_export (** big_inputs )
150152 else :
151153 expected = None
152154 expected_big = None
@@ -192,7 +194,9 @@ def _config_reduction(config, task):
192194 ):
193195 if expected is None :
194196 expected = model_to_export (** inputs )
195- expected_big = model_to_export (** big_inputs )
197+ expected_big = (
198+ None if big_inputs is None else model_to_export (** big_inputs )
199+ )
196200 to_onnx (
197201 model_to_export ,
198202 kwargs = export_inputs ,
@@ -265,7 +269,7 @@ def _config_reduction(config, task):
265269 (f"test_qwen25_vli_visual.{ device } .{ dtype } .{ attention } .{ exporter } " ),
266270 filename ,
267271 model_to_export ,
268- [export_inputs , big_inputs ],
272+ [_ for _ in [ export_inputs , big_inputs ] if _ is not None ],
269273 verbose = 1 ,
270274 providers = (
271275 ["CUDAExecutionProvider" , "CPUExecutionProvider" ]
@@ -276,7 +280,7 @@ def _config_reduction(config, task):
276280 atol = 0.05 ,
277281 rtol = 10 ,
278282 # ep=pt2_file,
279- expected = [expected , expected_big ],
283+ expected = [_ for _ in [ expected , expected_big ] if _ is not None ],
280284 log_severity_level = 0 ,
281285 log_verbosity_level = 0 ,
282286 )
0 commit comments