From a13e8271838499a0f6126d44b4d7f4b9c66e3816 Mon Sep 17 00:00:00 2001 From: Jiali Mei Date: Wed, 8 Mar 2023 16:51:03 +0100 Subject: [PATCH 1/3] Edit the docstring of `image_processing_donut` to match code --- .../models/donut/image_processing_donut.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/transformers/models/donut/image_processing_donut.py b/src/transformers/models/donut/image_processing_donut.py index 325a2bb9b602..ec57a5235f4e 100644 --- a/src/transformers/models/donut/image_processing_donut.py +++ b/src/transformers/models/donut/image_processing_donut.py @@ -63,12 +63,14 @@ class DonutImageProcessor(BaseImageProcessor): method. resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`): Resampling filter to use if resizing the image. Can be overridden by `resample` in the `preprocess` method. - do_center_crop (`bool`, *optional*, defaults to `True`): - Whether to center crop the image to the specified `crop_size`. Can be overridden by `do_center_crop` in the - `preprocess` method. - crop_size (`Dict[str, int]` *optional*, defaults to 224): - Size of the output image after applying `center_crop`. Can be overridden by `crop_size` in the `preprocess` - method. + do_thumbnail (`bool`, *optional*, defaults to `True`): + Whether to resize the image using thumbnail method. + do_align_long_axis (`bool`, *optional*, defaults to `False`): + Whether to align the long axis of the image with the long axis of `size` by rotating by 90 degrees. + do_pad (`bool`, *optional*, defaults to `True`): + Whether to pad the image. If `random_padding` is set to `True` in `preprocess`, each image is padded with + a random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images + are padded to the largest image size in the batch. do_rescale (`bool`, *optional*, defaults to `True`): Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by `do_rescale` in the `preprocess` method. @@ -82,9 +84,6 @@ class DonutImageProcessor(BaseImageProcessor): channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method. image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`): Image standard deviation. - do_convert_rgb (`bool`, *optional*, defaults to `True`): - Standard deviation to use if normalizing the image. This is a float or list of floats the length of the - number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method. """ model_input_names = ["pixel_values"] From fdbfe3ae099159e4469ac3da4b6cc15a64f8dd88 Mon Sep 17 00:00:00 2001 From: Jiali Mei Date: Thu, 9 Mar 2023 12:37:19 +0000 Subject: [PATCH 2/3] improve style --- src/transformers/models/donut/image_processing_donut.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/models/donut/image_processing_donut.py b/src/transformers/models/donut/image_processing_donut.py index ec57a5235f4e..79582a39939f 100644 --- a/src/transformers/models/donut/image_processing_donut.py +++ b/src/transformers/models/donut/image_processing_donut.py @@ -68,8 +68,8 @@ class DonutImageProcessor(BaseImageProcessor): do_align_long_axis (`bool`, *optional*, defaults to `False`): Whether to align the long axis of the image with the long axis of `size` by rotating by 90 degrees. do_pad (`bool`, *optional*, defaults to `True`): - Whether to pad the image. If `random_padding` is set to `True` in `preprocess`, each image is padded with - a random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images + Whether to pad the image. If `random_padding` is set to `True` in `preprocess`, each image is padded with + a random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images are padded to the largest image size in the batch. do_rescale (`bool`, *optional*, defaults to `True`): Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by `do_rescale` in From 7a3b4e6c719f2af2db23ed6de07f73fa6b4b4457 Mon Sep 17 00:00:00 2001 From: Jiali Mei Date: Thu, 9 Mar 2023 17:11:14 +0000 Subject: [PATCH 3/3] more style improvement after installing quality --- src/transformers/models/donut/image_processing_donut.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/transformers/models/donut/image_processing_donut.py b/src/transformers/models/donut/image_processing_donut.py index 79582a39939f..c94927472915 100644 --- a/src/transformers/models/donut/image_processing_donut.py +++ b/src/transformers/models/donut/image_processing_donut.py @@ -68,9 +68,9 @@ class DonutImageProcessor(BaseImageProcessor): do_align_long_axis (`bool`, *optional*, defaults to `False`): Whether to align the long axis of the image with the long axis of `size` by rotating by 90 degrees. do_pad (`bool`, *optional*, defaults to `True`): - Whether to pad the image. If `random_padding` is set to `True` in `preprocess`, each image is padded with - a random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images - are padded to the largest image size in the batch. + Whether to pad the image. If `random_padding` is set to `True` in `preprocess`, each image is padded with a + random amont of padding on each size, up to the largest image size in the batch. Otherwise, all images are + padded to the largest image size in the batch. do_rescale (`bool`, *optional*, defaults to `True`): Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by `do_rescale` in the `preprocess` method.