mirror of
https://github.com/ostris/ai-toolkit.git
synced 2026-01-26 16:39:47 +00:00
Massive speed increase. Added latent caching both to disk and to memory
This commit is contained in:
22
toolkit/progress_bar.py
Normal file
22
toolkit/progress_bar.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from tqdm import tqdm
|
||||
import time
|
||||
|
||||
|
||||
class ToolkitProgressBar(tqdm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.paused = False
|
||||
|
||||
def pause(self):
|
||||
if not self.paused:
|
||||
self.paused = True
|
||||
self.last_time = self._time()
|
||||
|
||||
def unpause(self):
|
||||
if self.paused:
|
||||
self.paused = False
|
||||
self.start_t += self._time() - self.last_time
|
||||
|
||||
def update(self, *args, **kwargs):
|
||||
if not self.paused:
|
||||
super().update(*args, **kwargs)
|
||||
Reference in New Issue
Block a user