Skip to content

Commit

Permalink
fix incorrect warning (huggingface#34416)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonigozlan authored and BernardZach committed Dec 5, 2024
1 parent fa26f41 commit abb1802
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/transformers/processing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,12 +874,13 @@ class MyProcessingKwargs(ProcessingKwargs, CommonKwargs, TextKwargs, ImagesKwarg
else:
# kwargs is a flat dictionary
for key in kwargs:
if key not in ModelProcessorKwargs.__annotations__["common_kwargs"].__annotations__.keys():
logger.warning_once(
f"Keyword argument `{key}` is not a valid argument for this processor and will be ignored."
)
elif key not in used_keys:
output_kwargs["common_kwargs"][key] = kwargs[key]
if key not in used_keys:
if key in ModelProcessorKwargs.__annotations__["common_kwargs"].__annotations__.keys():
output_kwargs["common_kwargs"][key] = kwargs[key]
else:
logger.warning_once(
f"Keyword argument `{key}` is not a valid argument for this processor and will be ignored."
)

# all modality-specific kwargs are updated with common kwargs
for modality in output_kwargs:
Expand Down

0 comments on commit abb1802

Please sign in to comment.