Skip to content

Commit 74d56be

Browse files
committed
only use kwargs that are in cls.valid_kwargs
1 parent b5c2aaf commit 74d56be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/transformers/image_processing_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs):
364364
return_unused_kwargs = kwargs.pop("return_unused_kwargs", False)
365365
# remove _from_auto from kwargs before updating the image processor dict
366366
kwargs.pop("_from_auto", None)
367-
image_processor_dict.update(kwargs)
367+
image_processor_dict.update({k: v for k, v in kwargs.items() if k in cls.valid_kwargs.__annotations__})
368368
image_processor = cls(**image_processor_dict)
369369

370370
# Remove kwargs that are used to initialize the image processor attributes

0 commit comments

Comments
 (0)