showlab / MotionDirector

[ECCV 2024 Oral] MotionDirector: Motion Customization of Text-to-Video Diffusion Models.
https://showlab.github.io/MotionDirector/
Apache License 2.0
850 stars 54 forks source link

Memory Leak #12

Open deepbeepmeep opened 11 months ago

deepbeepmeep commented 11 months ago

Thanks for this very interesting work that at last allows us to have some level of direction in video generation. First run works quite well (less than 40s on a RTX 4090 24GB) but successive runs are very slow. There is obviously a memory leak towards the end of the generation process as GPU memory is never released.

deepbeepmeep commented 11 months ago

Ok I found a fix, it is the VAE that clutters the GPU memory.

In file "demo/motiondirectory.py" Add the following just after line 155 ( device ="cuda")

_self.pipe.enable_vaeslicing()

ruizhaocv commented 11 months ago

Thanks a lot. The demo script has been updated to fix this issue.