Fix typing issues with SigLip2 (#37356)
* Fix issues * Fix comment --------- Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>
This commit is contained in:
@@ -691,8 +691,12 @@ class BaseImageProcessorFast(BaseImageProcessor):
|
||||
|
||||
# torch resize uses interpolation instead of resample
|
||||
resample = kwargs.pop("resample")
|
||||
|
||||
# Check if resample is an int before checking if it's an instance of PILImageResampling
|
||||
# because if pillow < 9.1.0, resample is an int and PILImageResampling is a module.
|
||||
# Checking PILImageResampling will fail with error `TypeError: isinstance() arg 2 must be a type or tuple of types`.
|
||||
kwargs["interpolation"] = (
|
||||
pil_torch_interpolation_mapping[resample] if isinstance(resample, (PILImageResampling, int)) else resample
|
||||
pil_torch_interpolation_mapping[resample] if isinstance(resample, (int, PILImageResampling)) else resample
|
||||
)
|
||||
|
||||
# Pop kwargs that are not needed in _preprocess
|
||||
|
||||
Reference in New Issue
Block a user