Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,8 @@ pipe = CogVideoXPipeline.from_pretrained(
|
|
14 |
)
|
15 |
pipe.enable_model_cpu_offload() # auto move submodules between CPU/GPU
|
16 |
pipe.vae.enable_slicing() # slice VAE for extra VRAM savings
|
|
|
|
|
17 |
|
18 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
19 |
# 2. Resolution parsing & sanitization
|
@@ -60,8 +62,15 @@ def generate_video(
|
|
60 |
|
61 |
# 3.4 Export to MP4 (H.264) with chosen FPS
|
62 |
video_path = export_to_video(resized_frames, "generated.mp4", fps=fps)
|
|
|
|
|
|
|
|
|
|
|
63 |
return video_path
|
64 |
|
|
|
|
|
65 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
66 |
# 4. Build the Gradio interface with interactive controls
|
67 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
14 |
)
|
15 |
pipe.enable_model_cpu_offload() # auto move submodules between CPU/GPU
|
16 |
pipe.vae.enable_slicing() # slice VAE for extra VRAM savings
|
17 |
+
pipe.enable_attention_slicing()
|
18 |
+
pipe.enable_unet_slicing()
|
19 |
|
20 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
21 |
# 2. Resolution parsing & sanitization
|
|
|
62 |
|
63 |
# 3.4 Export to MP4 (H.264) with chosen FPS
|
64 |
video_path = export_to_video(resized_frames, "generated.mp4", fps=fps)
|
65 |
+
|
66 |
+
import torch
|
67 |
+
torch.cuda.empty_cache()
|
68 |
+
pipe.to("cpu")
|
69 |
+
|
70 |
return video_path
|
71 |
|
72 |
+
|
73 |
+
|
74 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
75 |
# 4. Build the Gradio interface with interactive controls
|
76 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|