mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-03-06 02:59:48 +00:00
Massive speed increase. Added latent caching both to disk and to memory
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
import gc
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
def value_map(inputs, min_in, max_in, min_out, max_out):
|
||||
return (inputs - min_in) * (max_out - min_out) / (max_in - min_in) + min_out
|
||||
|
||||
|
||||
def flush(garbage_collect=True):
|
||||
torch.cuda.empty_cache()
|
||||
if garbage_collect:
|
||||
gc.collect()
|
||||
|
||||
Reference in New Issue
Block a user