@@ -284,19 +284,20 @@ def test_ipex_patching_beam_search(self, test_name, model_arch, use_cache):
284
284
texts = ["This is a sample" , ["This is the first input" , "This is the second input" ]]
285
285
generation_configs = (
286
286
GenerationConfig (max_new_tokens = 4 , num_beams = 2 , do_sample = True ),
287
- GenerationConfig (max_new_tokens = 4 , num_beams = 4 , do_sample = True ),
288
- GenerationConfig (max_new_tokens = 4 , num_beams = 8 , do_sample = True ),
287
+ GenerationConfig (max_new_tokens = 4 , num_beams = 4 , do_sample = True ),
288
+ GenerationConfig (max_new_tokens = 4 , num_beams = 8 , do_sample = True ),
289
289
GenerationConfig (max_new_tokens = 4 , num_beams = 32 , do_sample = True ),
290
290
GenerationConfig (max_new_tokens = 4 , do_sample = not use_cache , top_p = 1.0 , top_k = 5 , penalty_alpha = 0.6 ),
291
291
GenerationConfig (max_new_tokens = 4 , do_sample = True , top_p = 0.9 , top_k = 0 ),
292
- )
292
+ )
293
293
for text in texts :
294
294
tokens = tokenizer (text , padding = True , return_tensors = "pt" )
295
295
for generation_config in generation_configs :
296
296
outputs = model .generate (** tokens , generation_config = generation_config )
297
297
transformers_outputs = trasnformers_model .generate (** tokens , generation_config = generation_config )
298
298
self .assertIsInstance (outputs , torch .Tensor )
299
299
self .assertEqual (outputs , transformers_outputs )
300
+
300
301
def test_compare_with_and_without_past_key_values (self ):
301
302
model_id = "echarlaix/tiny-random-gpt2-torchscript"
302
303
tokenizer = AutoTokenizer .from_pretrained (model_id )
0 commit comments