Repository: huggingface/diffusers

Issue:
Running CLIP Guided Stable Diffusion fails with Size should be int or sequence. Got <class 'dict'>
### Describe the bug

I'm trying to run the example of this pipeline [examples/community#clip-guided-stable-diffusion](https://github.com/huggingface/diffusers/tree/main/examples/community#clip-guided-stable-diffusion). But this seems to fails with following error

```python
TypeError: Size should be int or sequence. Got <class 'dict'>
```

It seems the problem is in step
```python
    image = guided_pipeline(
        prompt,
        num_inference_steps=50,
        guidance_scale=7.5,
        clip_guidance_scale=100,
        num_cutouts=4,
        use_cutouts=False,
        generator=generator,
    ).images[0]
```
Looking at the exact problem location, it seems here in `clip_guided_stable_diffusion.py`
```python
--> 160             image = transforms.Resize(self.feature_extractor.size)(image)
```

In fact calling `feature_extractor.size` returns a dictionary `{'shortest_edge': 224}` which is causing the problem.


### Reproduction

Simply run the example from [community#clip-guided-stable-diffusion](https://github.com/huggingface/diffusers/tree/main/examples/community#clip-guided-stable-diffusion)

### Logs

```shell
Full stack trace

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-8a073b55c1c7> in <module>
     24 images = []
     25 for i in range(4):
---> 26     image = guided_pipeline(
     27         prompt,
     28         num_inference_steps=50,

4 frames
/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     25         def decorate_context(*args, **kwargs):
     26             with self.clone():
---> 27                 return func(*args, **kwargs)
     28         return cast(F, decorate_context)
     29 

~/.cache/huggingface/modules/diffusers_modules/git/clip_guided_stable_diffusion.py in __call__(self, prompt, height, width, num_inference_steps, guidance_scale, num_images_per_prompt, eta, clip_guidance_scale, clip_prompt, num_cutouts, use_cutouts, generator, latents, output_type, return_dict)
    321                     text_embeddings.chunk(2)[1] if do_classifier_free_guidance else text_embeddings
    322                 )
--> 323                 noise_pred, latents = self.cond_fn(
    324                     latents,
    325                     t,

/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     25         def decorate_context(*args, **kwargs):
     26             with self.clone():
---> 27                 return func(*args, **kwargs)
     28         return cast(F, decorate_context)
     29 

~/.cache/huggingface/modules/diffusers_modules/git/clip_guided_stable_diffusion.py in cond_fn(self, latents, timestep, index, text_embeddings, noise_pred_original, text_embeddings_clip, clip_guidance_scale, num_cutouts, use_cutouts)
    158             image = self.make_cutouts(image, num_cutouts)
    159         else:
--> 160             image = transforms.Resize(self.feature_extractor.size)(image)
    161         image = self.normalize(image).to(latents.dtype)
    162 

/usr/local/lib/python3.8/dist-packages/torchvision/transforms/transforms.py in __init__(self, size, interpolation, max_size, antialias)
    319         _log_api_usage_once(self)
    320         if not isinstance(size, (int, Sequence)):
--> 321             raise TypeError(f"Size should be int or sequence. Got {type(size)}")
    322         if isinstance(size, Sequence) and len(size) not in (1, 2):
    323             raise ValueError("If size is a sequence, it should have 1 or 2 values")

TypeError: Size should be int or sequence. Got <class 'dict'>
```


### System Info

Using Colab with
- diffusers 0.11.1
- transformers 4.25.1
- torch 1.13.0+cu116


Discussion:
cc @patil-suraj 

Resolving patch:
diff --git a/examples/community/clip_guided_stable_diffusion.py b/examples/community/clip_guided_stable_diffusion.py
--- a/examples/community/clip_guided_stable_diffusion.py
+++ b/examples/community/clip_guided_stable_diffusion.py
@@ -78,12 +78,12 @@ def __init__(
         )
 
         self.normalize = transforms.Normalize(mean=feature_extractor.image_mean, std=feature_extractor.image_std)
-        cut_out_size = (
+        self.cut_out_size = (
             feature_extractor.size
             if isinstance(feature_extractor.size, int)
             else feature_extractor.size["shortest_edge"]
         )
-        self.make_cutouts = MakeCutouts(cut_out_size)
+        self.make_cutouts = MakeCutouts(self.cut_out_size)
 
         set_requires_grad(self.text_encoder, False)
         set_requires_grad(self.clip_model, False)
@@ -157,7 +157,7 @@ def cond_fn(
         if use_cutouts:
             image = self.make_cutouts(image, num_cutouts)
         else:
-            image = transforms.Resize(self.feature_extractor.size)(image)
+            image = transforms.Resize(self.cut_out_size)(image)
         image = self.normalize(image).to(latents.dtype)
 
         image_embeddings_clip = self.clip_model.get_image_features(image)


Test patch: