@@ -328,9 +328,7 @@ def tearDown(self):
328328
329329 @slow
330330 def test_small_model_integration_test (self ):
331- model = Glm4vMoeForConditionalGeneration .from_pretrained (
332- "zai-org/GLM-4.5V" , torch_dtype = "auto" , device_map = "auto"
333- )
331+ model = Glm4vMoeForConditionalGeneration .from_pretrained ("zai-org/GLM-4.5V" , dtype = "auto" , device_map = "auto" )
334332
335333 inputs = self .processor .apply_chat_template (
336334 self .message , tokenize = True , add_generation_prompt = True , return_dict = True , return_tensors = "pt"
@@ -364,9 +362,7 @@ def test_small_model_integration_test(self):
364362
365363 @slow
366364 def test_small_model_integration_test_batch (self ):
367- model = Glm4vMoeForConditionalGeneration .from_pretrained (
368- "zai-org/GLM-4.5V" , torch_dtype = "auto" , device_map = "auto"
369- )
365+ model = Glm4vMoeForConditionalGeneration .from_pretrained ("zai-org/GLM-4.5V" , dtype = "auto" , device_map = "auto" )
370366 batch_messages = [self .message ] * 2
371367 inputs = self .processor .apply_chat_template (
372368 batch_messages , tokenize = True , add_generation_prompt = True , return_dict = True , return_tensors = "pt"
@@ -388,7 +384,7 @@ def test_small_model_integration_test_batch(self):
388384 def test_small_model_integration_test_with_video (self ):
389385 processor = AutoProcessor .from_pretrained ("zai-org/GLM-4.5V" , max_image_size = {"longest_edge" : 50176 })
390386 model = Glm4vMoeForConditionalGeneration .from_pretrained (
391- "zai-org/GLM-4.5V" , torch_dtype = torch .float16 , device_map = "auto"
387+ "zai-org/GLM-4.5V" , dtype = torch .float16 , device_map = "auto"
392388 )
393389 questions = ["Describe this video." ] * 2
394390 video_urls = [
@@ -424,9 +420,7 @@ def test_small_model_integration_test_with_video(self):
424420
425421 @slow
426422 def test_small_model_integration_test_expand (self ):
427- model = Glm4vMoeForConditionalGeneration .from_pretrained (
428- "zai-org/GLM-4.5V" , torch_dtype = "auto" , device_map = "auto"
429- )
423+ model = Glm4vMoeForConditionalGeneration .from_pretrained ("zai-org/GLM-4.5V" , dtype = "auto" , device_map = "auto" )
430424 inputs = self .processor .apply_chat_template (
431425 self .message , tokenize = True , add_generation_prompt = True , return_dict = True , return_tensors = "pt"
432426 ).to (torch_device )
@@ -444,9 +438,7 @@ def test_small_model_integration_test_expand(self):
444438
445439 @slow
446440 def test_small_model_integration_test_batch_wo_image (self ):
447- model = Glm4vMoeForConditionalGeneration .from_pretrained (
448- "zai-org/GLM-4.5V" , torch_dtype = "auto" , device_map = "auto"
449- )
441+ model = Glm4vMoeForConditionalGeneration .from_pretrained ("zai-org/GLM-4.5V" , dtype = "auto" , device_map = "auto" )
450442 message_wo_image = [
451443 {"role" : "user" , "content" : [{"type" : "text" , "text" : "Who are you?" }]},
452444 ]
@@ -474,9 +466,7 @@ def test_small_model_integration_test_batch_wo_image(self):
474466
475467 @slow
476468 def test_small_model_integration_test_batch_different_resolutions (self ):
477- model = Glm4vMoeForConditionalGeneration .from_pretrained (
478- "zai-org/GLM-4.5V" , torch_dtype = "auto" , device_map = "auto"
479- )
469+ model = Glm4vMoeForConditionalGeneration .from_pretrained ("zai-org/GLM-4.5V" , dtype = "auto" , device_map = "auto" )
480470 batched_messages = [self .message , self .message2 ]
481471 inputs = self .processor .apply_chat_template (
482472 batched_messages ,
@@ -505,7 +495,7 @@ def test_small_model_integration_test_batch_different_resolutions(self):
505495 def test_small_model_integration_test_batch_flashatt2 (self ):
506496 model = Glm4vMoeForConditionalGeneration .from_pretrained (
507497 "zai-org/GLM-4.5V" ,
508- torch_dtype = torch .bfloat16 ,
498+ dtype = torch .bfloat16 ,
509499 attn_implementation = "flash_attention_2" ,
510500 device_map = "auto" ,
511501 )
@@ -537,7 +527,7 @@ def test_small_model_integration_test_batch_flashatt2(self):
537527 def test_small_model_integration_test_batch_wo_image_flashatt2 (self ):
538528 model = Glm4vMoeForConditionalGeneration .from_pretrained (
539529 "zai-org/GLM-4.5V" ,
540- torch_dtype = torch .bfloat16 ,
530+ dtype = torch .bfloat16 ,
541531 attn_implementation = "flash_attention_2" ,
542532 device_map = "auto" ,
543533 )
0 commit comments