mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
+5
-12
@@ -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}')
|
||||
|
||||
Reference in New Issue
Block a user