[ViT] `'str' object cannot be interpreted as an integer`
Author: younesbelkada
Pull request: no

### System Info

using `transformers==4.24.0`, the snippet:

```
import requests
from PIL import Image
from transformers import AutoProcessor

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

# Use the same feature extractor for everyone
feature_extractor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-ViTModel")
inputs = feature_extractor(images=image, return_tensors="pt")
```
fails with the error: 
```
2022-11-22 13:06:49.965720: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-11-22 13:06:50.154832: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2022-11-22 13:06:50.732918: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/usr/local/nccl2/lib:/usr/local/cuda/extras/CUPTI/lib64
2022-11-22 13:06:50.733007: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/usr/local/nccl2/lib:/usr/local/cuda/extras/CUPTI/lib64
2022-11-22 13:06:50.733017: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
Traceback (most recent call last):
  File "/home/younes_huggingface_co/scratch/test_processor.py", line 10, in <module>
    inputs = feature_extractor(images=image, return_tensors="pt")
  File "/home/younes_huggingface_co/miniconda3/envs/fix-bnb-test/lib/python3.10/site-packages/transformers/models/vit/feature_extraction_vit.py", line 144, in __call__
    images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
  File "/home/younes_huggingface_co/miniconda3/envs/fix-bnb-test/lib/python3.10/site-packages/transformers/models/vit/feature_extraction_vit.py", line 144, in <listcomp>
    images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
  File "/home/younes_huggingface_co/miniconda3/envs/fix-bnb-test/lib/python3.10/site-packages/transformers/image_utils.py", line 418, in resize
    return image.resize(size, resample=resample)
  File "/home/younes_huggingface_co/miniconda3/envs/fix-bnb-test/lib/python3.10/site-packages/PIL/Image.py", line 2082, in resize
    return self._new(self.im.resize(size, resample, box))
TypeError: 'str' object cannot be interpreted as an integer

```

However, using the main branch fixes the issue, so just flagging it!

cc @sgugger


Comments:
cc @amyeroberts 

False alarm! 
the snippet works when using `google/vit-base-patch16-224`
```
import requests
from PIL import Image
from transformers import AutoProcessor

model_id = "google/vit-base-patch16-224"

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

# Use the same feature extractor for everyone
feature_extractor = AutoProcessor.from_pretrained(model_id)
inputs = feature_extractor(images=image, return_tensors="pt")
```
so I expect the fix to be on `hf-internal-testing/tiny-random-ViTModel`, updating `size` attribute by an integer seems to fix the issue.

Opened a PR in: https://huggingface.co/hf-internal-testing/tiny-random-ViTModel/discussions/2

I don't think the model should be updated. It does require a source install of Transformers but it was also added since the last release, so it's fair IMO.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.