|
18 | 18 | validate_preprocess_arguments, |
19 | 19 | ) |
20 | 20 | from transformers.utils import TensorType, logging |
21 | | -from transformers.video_utils import VideoInput, make_batched_videos |
| 21 | +from transformers.video_utils import VideoInput |
22 | 22 |
|
23 | 23 | from ...image_processing_utils import BaseImageProcessor |
24 | 24 | from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format |
@@ -445,42 +445,11 @@ def preprocess( |
445 | 445 | } |
446 | 446 | ) |
447 | 447 |
|
448 | | - # kept for BC only and should be removed after v5.0 |
449 | 448 | if videos is not None: |
450 | | - logger.warning( |
| 449 | + raise ValueError( |
451 | 450 | "`Videollama3ImageProcessor` works only with image inputs and doesn't process videos anymore. " |
452 | | - "This is a deprecated behavior and will be removed in v5.0. " |
453 | 451 | "Your videos should be forwarded to `Videollama3VideoProcessor`. " |
454 | 452 | ) |
455 | | - videos = make_batched_videos(videos) |
456 | | - pixel_values_videos, vision_grid_thws_videos = [], [] |
457 | | - for images in videos: |
458 | | - patches, video_grid_thw = self._preprocess( |
459 | | - images, |
460 | | - do_resize=do_resize, |
461 | | - size=size, |
462 | | - resample=resample, |
463 | | - do_rescale=do_rescale, |
464 | | - rescale_factor=rescale_factor, |
465 | | - do_normalize=do_normalize, |
466 | | - image_mean=image_mean, |
467 | | - image_std=image_std, |
468 | | - patch_size=patch_size, |
469 | | - temporal_patch_size=temporal_patch_size, |
470 | | - merge_size=merge_size, |
471 | | - data_format=data_format, |
472 | | - do_convert_rgb=do_convert_rgb, |
473 | | - input_data_format=input_data_format, |
474 | | - ) |
475 | | - pixel_values_videos.extend(patches) |
476 | | - vision_grid_thws_videos.append(video_grid_thw) |
477 | | - data.update( |
478 | | - { |
479 | | - "pixel_values_videos": np.array(pixel_values_videos), |
480 | | - "video_grid_thw": np.array(vision_grid_thws_videos), |
481 | | - "video_merge_sizes": np.array([merge_size] * len(vision_grid_thws_videos)), |
482 | | - } |
483 | | - ) |
484 | 453 |
|
485 | 454 | return BatchFeature(data=data, tensor_type=return_tensors) |
486 | 455 |
|
|
0 commit comments