From cbddaf4e9e4b8fd076506b39c83b0300775c82ec Mon Sep 17 00:00:00 2001 From: Tibor Reiss Date: Fri, 29 Nov 2024 09:10:50 +0100 Subject: [PATCH] Order matters - task_inputs has to be first --- src/transformers/models/oneformer/processing_oneformer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/transformers/models/oneformer/processing_oneformer.py b/src/transformers/models/oneformer/processing_oneformer.py index 2b13beaf565ce6..d30091c69242b0 100644 --- a/src/transformers/models/oneformer/processing_oneformer.py +++ b/src/transformers/models/oneformer/processing_oneformer.py @@ -74,7 +74,7 @@ class OneFormerProcessor(ProcessorMixin): attributes = ["image_processor", "tokenizer"] image_processor_class = "OneFormerImageProcessor" tokenizer_class = ("CLIPTokenizer", "CLIPTokenizerFast") - optional_call_args = ["segmentation_maps", "task_inputs"] + optional_call_args = ["task_inputs", "segmentation_maps"] def __init__( self, @@ -120,7 +120,7 @@ def _validate_input_types( def __call__( self, images: Optional[ImageInput] = None, - # The following is to capture `segmentation_maps` and `task_inputs` arguments + # The following is to capture `task_inputs and `segmentation_maps` arguments # that may be passed as a positional argument. # See transformers.processing_utils.ProcessorMixin.prepare_and_validate_optional_call_args for more details, # or this conversation for more context: @@ -169,8 +169,8 @@ def __call__( **kwargs, **self.prepare_and_validate_optional_call_args(*args), ) - segmentation_maps = output_kwargs["images_kwargs"].pop("segmentation_maps", None) task_inputs = output_kwargs["images_kwargs"].pop("task_inputs", None) + segmentation_maps = output_kwargs["images_kwargs"].pop("segmentation_maps", None) if isinstance(task_inputs, str): task_inputs = [task_inputs] self._validate_input_types(images, task_inputs)