Skip to content

Commit abb1802

Browse files
yonigozlanBernardZach
authored andcommitted
fix incorrect warning (huggingface#34416)
1 parent fa26f41 commit abb1802

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/transformers/processing_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -874,12 +874,13 @@ class MyProcessingKwargs(ProcessingKwargs, CommonKwargs, TextKwargs, ImagesKwarg
874874
else:
875875
# kwargs is a flat dictionary
876876
for key in kwargs:
877-
if key not in ModelProcessorKwargs.__annotations__["common_kwargs"].__annotations__.keys():
878-
logger.warning_once(
879-
f"Keyword argument `{key}` is not a valid argument for this processor and will be ignored."
880-
)
881-
elif key not in used_keys:
882-
output_kwargs["common_kwargs"][key] = kwargs[key]
877+
if key not in used_keys:
878+
if key in ModelProcessorKwargs.__annotations__["common_kwargs"].__annotations__.keys():
879+
output_kwargs["common_kwargs"][key] = kwargs[key]
880+
else:
881+
logger.warning_once(
882+
f"Keyword argument `{key}` is not a valid argument for this processor and will be ignored."
883+
)
883884

884885
# all modality-specific kwargs are updated with common kwargs
885886
for modality in output_kwargs:

0 commit comments

Comments
 (0)