MCPcopy Index your code
hub / github.com/ostris/ai-toolkit / flush

Function flush

toolkit/basic.py:11–18  ·  view source on GitHub ↗
(garbage_collect=True)

Source from the content-addressed store, hash-verified

9
10
11def flush(garbage_collect=True):
12 if torch.cuda.is_available():
13 torch.cuda.empty_cache()
14 # if is mps, also clear the mps cache
15 if torch.backends.mps.is_available():
16 torch.mps.empty_cache()
17 if garbage_collect:
18 gc.collect()
19
20
21def get_mean_std(tensor):

Callers 15

load_modelMethod · 0.90
load_refinerMethod · 0.90
generate_imagesMethod · 0.90
save_refinerMethod · 0.90
set_device_stateMethod · 0.90
unload_text_encoderFunction · 0.90
setup_controlsMethod · 0.90
generate_imagesMethod · 0.90
set_device_stateMethod · 0.90
load_modelMethod · 0.90
__call__Method · 0.90
load_modelMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected