Skip to content

Commit

Permalink
Order matters - task_inputs has to be first
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-reiss committed Nov 29, 2024
1 parent 20a275b commit cbddaf4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/transformers/models/oneformer/processing_oneformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cbddaf4

Please sign in to comment.