Clear Video Memory on Colab

I tried torch.cuda.empty_cache() but no luck with diffusion pipeline. How can I clear video memory after an image generation?

From what I know…

  1. You can kill a process:
    1.1 !nvidia-smi (find your process [id])
    1.2 !kill [id]

  2. By numba:
    2.1 !pip install numba
    2.2 from numba import cuda
    2.3 device = cuda.get_current_device()
    2.4 device.reset()