Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2024-10-09 11:17:58 -04:00
parent 723ce74986
commit 8f8f0d6df1
+5 -12
View File
@@ -43,18 +43,16 @@ class History():
shared.log.info(f'History: items={self.count}/{shared.opts.latent_history} size={self.size}')
return [item.name for item in self.latents]
@property
def latest(self):
return self.get(0)
@property
def selected(self):
if self.index >= 0 and self.index < self.count:
index = self.index
latent = self.get(self.index)
self.index = -1
return latent, index
return self.latest, -1
else:
index = 0
item = self.latents[index]
shared.log.debug(f'History get: index={index} time={item.ts} shape={item.latent.shape} dtype={item.latent.dtype} count={self.count}')
return item.latent.to(devices.device), index
def find(self, name):
for i, item in enumerate(self.latents):
@@ -69,11 +67,6 @@ class History():
if self.count >= shared.opts.latent_history:
self.latents.pop()
def get(self, index: int = 0):
item = self.latents[index]
# shared.log.debug(f'History get: index={index} time={item.ts} shape={item.latent.shape} dtype={item.latent.dtype} count={self.count}')
return item.latent.to(devices.device)
def clear(self):
self.latents.clear()
# shared.log.debug(f'History clear: count={self.count}')