Patch CLIP image preprocessor (#30698)

* patch clip preprocessor

* Update image_processing_clip.py

* Update src/transformers/models/clip/image_processing_clip.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
This commit is contained in:
Vinh H. Pham 2024-05-08 15:27:31 +07:00 committed by GitHub
parent 5b7a225f25
commit 508c0bfe55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,7 +141,7 @@ class CLIPImageProcessor(BaseImageProcessor):
]
# for backwards compatibility of KOSMOS-2
if "use_square_size" in kwargs:
if "use_square_size" in kwargs and kwargs["use_square_size"]:
self.size = {"height": size["shortest_edge"], "width": size["shortest_edge"]}
# Let's remove `use_square_size` (as it is removed from #27690), so the future Kosmos-2 image processors
# won't have this attr. being saved. (otherwise, it will enter this if branch while there is no more