Skip to content

Commit 98a3c49

Browse files
authored
Replace video_fps with fps in tests (#39898)
Signed-off-by: cyy <[email protected]>
1 parent 1af1071 commit 98a3c49

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

tests/models/internvl/test_processing_internvl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_apply_chat_template_video_frame_sampling(self):
234234
self.assertTrue(self.videos_input_name in out_dict_with_video)
235235
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), num_frames)
236236

237-
# Load with `video_fps` arg is not possible with InternVL (skip)
237+
# Load with `fps` arg is not possible with InternVL (skip)
238238

239239
# Load without any arg should use the default loading method
240240
out_dict_with_video = processor.apply_chat_template(

tests/models/qwen2_5_omni/test_processing_qwen2_5_omni.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,26 +488,26 @@ def test_apply_chat_template_video_frame_sampling(self):
488488
self.assertTrue(self.videos_input_name in out_dict_with_video)
489489
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 5760)
490490

491-
# Load with `video_fps` arg
492-
video_fps = 1
491+
# Load with `fps` arg
492+
fps = 1
493493
out_dict_with_video = processor.apply_chat_template(
494494
messages,
495495
add_generation_prompt=True,
496496
tokenize=True,
497497
return_dict=True,
498-
video_fps=video_fps,
498+
fps=fps,
499499
)
500500
self.assertTrue(self.videos_input_name in out_dict_with_video)
501501
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 14400)
502502

503-
# Load with `video_fps` and `num_frames` args, should raise an error
503+
# Load with `fps` and `num_frames` args, should raise an error
504504
with self.assertRaises(ValueError):
505505
out_dict_with_video = processor.apply_chat_template(
506506
messages,
507507
add_generation_prompt=True,
508508
tokenize=True,
509509
return_dict=True,
510-
video_fps=video_fps,
510+
fps=fps,
511511
num_frames=num_frames,
512512
)
513513

tests/models/qwen2_5_vl/test_processing_qwen2_5_vl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,26 +304,26 @@ def test_apply_chat_template_video_frame_sampling(self):
304304
self.assertTrue(self.videos_input_name in out_dict_with_video)
305305
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 360)
306306

307-
# Load with `video_fps` arg
308-
video_fps = 1
307+
# Load with `fps` arg
308+
fps = 1
309309
out_dict_with_video = processor.apply_chat_template(
310310
messages,
311311
add_generation_prompt=True,
312312
tokenize=True,
313313
return_dict=True,
314-
video_fps=video_fps,
314+
fps=fps,
315315
)
316316
self.assertTrue(self.videos_input_name in out_dict_with_video)
317317
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 900)
318318

319-
# Load with `video_fps` and `num_frames` args, should raise an error
319+
# Load with `fps` and `num_frames` args, should raise an error
320320
with self.assertRaises(ValueError):
321321
out_dict_with_video = processor.apply_chat_template(
322322
messages,
323323
add_generation_prompt=True,
324324
tokenize=True,
325325
return_dict=True,
326-
video_fps=video_fps,
326+
fps=fps,
327327
num_frames=num_frames,
328328
)
329329

tests/models/qwen2_vl/test_processing_qwen2_vl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,26 +304,26 @@ def test_apply_chat_template_video_frame_sampling(self):
304304
self.assertTrue(self.videos_input_name in out_dict_with_video)
305305
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 360)
306306

307-
# Load with `video_fps` arg
308-
video_fps = 1
307+
# Load with `fps` arg
308+
fps = 1
309309
out_dict_with_video = processor.apply_chat_template(
310310
messages,
311311
add_generation_prompt=True,
312312
tokenize=True,
313313
return_dict=True,
314-
video_fps=video_fps,
314+
fps=fps,
315315
)
316316
self.assertTrue(self.videos_input_name in out_dict_with_video)
317317
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 900)
318318

319-
# Load with `video_fps` and `num_frames` args, should raise an error
319+
# Load with `fps` and `num_frames` args, should raise an error
320320
with self.assertRaises(ValueError):
321321
out_dict_with_video = processor.apply_chat_template(
322322
messages,
323323
add_generation_prompt=True,
324324
tokenize=True,
325325
return_dict=True,
326-
video_fps=video_fps,
326+
fps=fps,
327327
num_frames=num_frames,
328328
)
329329

tests/models/smolvlm/test_processing_smolvlm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,20 +417,20 @@ def test_apply_chat_template_video_frame_sampling(self):
417417
# SmolVLM doesn't sample `num_frames` exactly, by uses other sampling method
418418
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), 3)
419419

420-
# Load with `video_fps` arg
421-
video_fps = 1
420+
# Load with `fps` arg
421+
fps = 1
422422
out_dict_with_video = processor.apply_chat_template(
423423
messages,
424424
add_generation_prompt=True,
425425
tokenize=True,
426426
return_dict=True,
427-
video_fps=video_fps,
427+
fps=fps,
428428
return_tensors="pt",
429429
)
430430
self.assertTrue(self.videos_input_name in out_dict_with_video)
431431
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 1)
432432
# SmolVLM doesn't sample 1 frame per second exactly, by uses other sampling method
433-
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), video_fps * 10)
433+
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), fps * 10)
434434

435435
# NOTE: the last assert checks are removed
436436
# Loading video as a list of frames (i.e. images) is not supported in SmolVLM

tests/test_processing_common.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -991,43 +991,43 @@ def test_apply_chat_template_video_frame_sampling(self):
991991
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 1)
992992
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), num_frames)
993993

994-
# Load with `video_fps` arg
995-
video_fps = 1
994+
# Load with `fps` arg
995+
fps = 1
996996
out_dict_with_video = processor.apply_chat_template(
997997
messages,
998998
add_generation_prompt=True,
999999
tokenize=True,
10001000
return_dict=True,
1001-
video_fps=video_fps,
1001+
fps=fps,
10021002
return_tensors="pt",
10031003
)
10041004
self.assertTrue(self.videos_input_name in out_dict_with_video)
10051005
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 1)
1006-
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), video_fps * 10)
1006+
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), fps * 10)
10071007

10081008
# Whan `do_sample_frames=False` no sampling is done and whole video is loaded, even if number of frames is passed
1009-
video_fps = 1
1009+
fps = 1
10101010
out_dict_with_video = processor.apply_chat_template(
10111011
messages,
10121012
add_generation_prompt=True,
10131013
tokenize=True,
10141014
return_dict=True,
10151015
do_sample_frames=False,
1016-
video_fps=video_fps,
1016+
fps=fps,
10171017
return_tensors="pt",
10181018
)
10191019
self.assertTrue(self.videos_input_name in out_dict_with_video)
10201020
self.assertEqual(len(out_dict_with_video[self.videos_input_name]), 1)
10211021
self.assertEqual(len(out_dict_with_video[self.videos_input_name][0]), 300)
10221022

1023-
# Load with `video_fps` and `num_frames` args, should raise an error
1023+
# Load with `fps` and `num_frames` args, should raise an error
10241024
with self.assertRaises(ValueError):
10251025
out_dict_with_video = processor.apply_chat_template(
10261026
messages,
10271027
add_generation_prompt=True,
10281028
tokenize=True,
10291029
return_dict=True,
1030-
video_fps=video_fps,
1030+
fps=fps,
10311031
num_frames=num_frames,
10321032
)
10331033

0 commit comments

Comments
 (0)