Problems while Running ImageGPT
### System Info

- `transformers` version: 4.28.1
- Platform: Linux-4.15.0-197-generic-x86_64-with-glibc2.27
- Python version: 3.11.3
- Huggingface_hub version: 0.15.1
- Safetensors version: not installed
- PyTorch version (GPU?): 2.0.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

I tried to run the code from the official example: 
https://huggingface.co/docs/transformers/model_doc/imagegpt#transformers.ImageGPTForCausalImageModeling
```python
from transformers import AutoImageProcessor, ImageGPTForCausalImageModeling
import torch
import matplotlib.pyplot as plt
import numpy as np

image_processor = AutoImageProcessor.from_pretrained("openai/imagegpt-small")
model = ImageGPTForCausalImageModeling.from_pretrained("openai/imagegpt-small")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)

# unconditional generation of 8 images
batch_size = 8
context = torch.full((batch_size, 1), model.config.vocab_size - 1)  # initialize with SOS token
context = torch.tensor(context).to(device)
output = model.generate(
    input_ids=context, max_length=model.config.n_positions + 1, temperature=1.0, do_sample=True, top_k=40
)

clusters = image_processor.clusters
height = image_processor.size["height"]
width = image_processor.size["width"]

samples = output[:, 1:].cpu().detach().numpy()
#Error line below   
samples_img = [
    np.reshape(np.rint(127.5 * (clusters[s] + 1.0)), [height, width, 3]).astype(np.uint8) for s in samples
]  # convert color cluster tokens back to pixels
f, axes = plt.subplots(1, batch_size, dpi=300)

for img, ax in zip(samples_img, axes):
    ax.axis("off")
    ax.imshow(img)
```

Error on line: ```samples_img = [...]``` on the part ```clusters[s]```. 

This is because: 
```samples.shape  = (8,1024)```
At that point, ```s.shape = (1024,)```. 
So, ```Clusters[s]``` cannot index properly. 

**Error Message**:  TypeError: only integer scalar arrays can be converted to a scalar index


### Expected behavior

It should plot 8 different predictions from the ImageGPT Model. 
![image](https://github.com/huggingface/transformers/assets/33897366/504978be-f708-4b67-b28a-5a82a01f0c50)

@chinge55 Thanks for reporting! Indeed, the example was assuming the clusters were a numpy array, but were stored as a list of lists in the image processor. I've opened a PR to resolve 