Update handler.py
Browse files- handler.py +5 -0
handler.py
CHANGED
@@ -12,6 +12,7 @@ import traceback
|
|
12 |
import os
|
13 |
import numpy as np
|
14 |
import torch
|
|
|
15 |
|
16 |
from diffusers import LTXPipeline, LTXImageToVideoPipeline
|
17 |
from diffusers.hooks import apply_enhance_a_video, EnhanceAVideoConfig
|
@@ -458,6 +459,10 @@ class EndpointHandler:
|
|
458 |
asyncio.set_event_loop(loop)
|
459 |
|
460 |
video_uri, metadata = loop.run_until_complete(self.process_frames(frames, config))
|
|
|
|
|
|
|
|
|
461 |
|
462 |
return {
|
463 |
"video": video_uri,
|
|
|
12 |
import os
|
13 |
import numpy as np
|
14 |
import torch
|
15 |
+
import gc
|
16 |
|
17 |
from diffusers import LTXPipeline, LTXImageToVideoPipeline
|
18 |
from diffusers.hooks import apply_enhance_a_video, EnhanceAVideoConfig
|
|
|
459 |
asyncio.set_event_loop(loop)
|
460 |
|
461 |
video_uri, metadata = loop.run_until_complete(self.process_frames(frames, config))
|
462 |
+
|
463 |
+
torch.cuda.empty_cache()
|
464 |
+
torch.cuda.reset_peak_memory_stats()
|
465 |
+
gc.collect()
|
466 |
|
467 |
return {
|
468 |
"video": video_uri,
|