Bug in DonutFeatureExtractor
Author: gagan3012
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.22.0.dev0
- Platform: Linux-5.10.133+-x86_64-with-debian-bullseye-sid
- Python version: 3.7.12
- Huggingface_hub version: 0.8.1
- PyTorch version (GPU?): 1.11.0 (True)
- Tensorflow version (GPU?): 2.6.4 (True)
- Flax version (CPU?/GPU?/TPU?): 0.5.2 (gpu)
- Jax version: 0.3.14
- JaxLib version: 0.3.14
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

### Who can help?

@NielsRogge

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```
tokenizer = AutoTokenizer.from_pretrained(token)

feature_extractor = DonutFeatureExtractor.from_pretrained(encoder)

processor = DonutProcessor(feature_extractor,tokenizer)

class OCRDataset(Dataset):
    def __init__(self, root_dir, df, processor, max_target_length=256):
        self.root_dir = root_dir
        self.df = df
        self.processor = processor
        self.max_target_length = max_target_length

    def __len__(self):
        return len(self.df)

    def __getitem__(self, idx):
        # get file name + text 
        #file_name = self.df['file_name'][idx]
        text = self.df['text'][idx]
        # prepare image (i.e. resize + normalize)
        image = self.df['image'][idx].convert("RGB")
        print(type(image))
        w, h = image.size
        #image = Image.open(self.root_dir + file_name).convert("RGB")
        pixel_values = self.processor([image], return_tensors="pt").pixel_values
        # add labels (input_ids) by encoding the text
        labels = self.processor.tokenizer(text, 
                                          padding="max_length", 
                                          max_length=self.max_target_length).input_ids
        # important: make sure that PAD tokens are ignored by the loss function
        labels = [label if label != self.processor.tokenizer.pad_token_id else -100 for label in labels]
        labels = torch.tensor(labels)
        encoding = {"pixel_values": pixel_values.squeeze(), "labels": labels}
        return encoding

train_dataset = OCRDataset(root_dir='',
                           df=dataset_train,
                           processor=processor)

encoding = train_dataset[1]

```

Error:

```

/opt/conda/lib/python3.7/site-packages/transformers/models/trocr/processing_trocr.py in __call__(self, *args, **kwargs)
     65 
     66         if images is not None:
---> 67             inputs = self.feature_extractor(images, *args, **kwargs)
     68         if text is not None:
     69             encodings = self.tokenizer(text, **kwargs)

/opt/conda/lib/python3.7/site-packages/transformers/models/donut/feature_extraction_donut.py in __call__(self, images, return_tensors, random_padding, **kwargs)
    193             images = [
    194                 self.resize(image=image, size=min(self.size), resample=self.resample, default_to_square=False)
--> 195                 for image in images
    196             ]
    197         if self.do_thumbnail and self.size is not None:

/opt/conda/lib/python3.7/site-packages/transformers/models/donut/feature_extraction_donut.py in <listcomp>(.0)
    193             images = [
    194                 self.resize(image=image, size=min(self.size), resample=self.resample, default_to_square=False)
--> 195                 for image in images
    196             ]
    197         if self.do_thumbnail and self.size is not None:

TypeError: 'int' object is not iterable
```

### Expected behavior

It should work

Comments:
Hi,

The [docstring](https://huggingface.co/docs/transformers/main/en/model_doc/donut#transformers.DonutFeatureExtractor.size) says that the size argument should be a tuple of (width, height).