[Diffusers] PyTorch running out of memory

Hi everyone, when I run this diffuser notebook on Colab, it works fine. But when I try to run it on Google Compute Engine with GPU, I get the following error:

PyTorch running out of memory: DefaultCPUAllocator can't allocate memory

Does anyone know how I can get around it?

Hi @howon92! The float16 models should fit into less than 7GB of GPU memory, so it might be that either Colab gives you a smaller GPU (could you check by running !nvidia-smi?) or pytorch doesn’t clear the memory between runs. Does your colab run out of memory even after resetting the runtime? Have you changed anything in the code, e.g. increased the number of inputs?