Skip to content
Python

Update text2video.py to reduce GPU memory by emptying cache (#44)

Adrian Corduneanu0e3c42a830ef
diff --git a/wan/text2video.py b/wan/text2video.py
index 96cfa78..2400545 100644
--- a/wan/text2video.py
+++ b/wan/text2video.py
@@ -252,6 +252,7 @@ class WanT2V:
x0 = latents
if offload_model:
self.model.cpu()
+ torch.cuda.empty_cache()
if self.rank == 0:
videos = self.vae.decode(x0)