# Colab load text-to-image model cause oom

**URL:** <https://discuss.huggingface.co/t/colab-load-text-to-image-model-cause-oom/100800>\
**Category:** Beginners\
**Created:** [August 4, 2024, 9:00am UTC](https://discuss.huggingface.co/t/colab-load-text-to-image-model-cause-oom/100800 "2024-08-04T09:00:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lfls](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@lfls](https://discuss.huggingface.co/u/lfls)\
**Post date:** [August 4, 2024, 9:00am UTC](https://discuss.huggingface.co/t/colab-load-text-to-image-model-cause-oom/100800/1 "2024-08-04T09:00:38Z")

</div>

I just want to play the model demo in google colab, when i install deps and run the demo code below:

```auto
import torch
from diffusers import StableDiffusion3Pipeline

pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16, token=token,use_safetensors=True)
pipe = pipe.to("cuda")

image = pipe(
    "A cat holding a sign that says hello world",
    negative_prompt="",
    num_inference_steps=28,
    guidance_scale=7.0,
).images[0]
image

```

i got an err below:

```auto
OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB. GPU 

```

this error is throwed by `pipe = pipe.to("cuda")`

when i changed the image model to a text generation model, it works well.

so does google colab’s resource can’t support run the image model on huggingface?

i searched on the internet and found some guys can do this successfully, anyone know how to solve this problem? thanks
