MCPcopy
hub / github.com/nikopueringer/CorridorKey / cleanup

Method cleanup

BiRefNetModule/wrapper.py:90–104  ·  view source on GitHub ↗

Explicitly clear model and release GPU memory.

(self)

Source from the content-addressed store, hash-verified

88 self.birefnet.half()
89
90 def cleanup(self):
91 """Explicitly clear model and release GPU memory."""
92 # Delete the model reference
93 if hasattr(self, "birefnet"):
94 del self.birefnet
95
96 # Clear Python garbage
97 import gc
98
99 gc.collect()
100
101 # Clear PyTorch CUDA cache
102 if torch.cuda.is_available():
103 torch.cuda.empty_cache()
104 torch.cuda.ipc_collect()
105
106 def process(self, input_path, alpha_output_dir=None, dilate_radius=0, on_frame_complete=None):
107 """

Callers 1

run_birefnetFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected