mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'development' into development
This commit is contained in:
commit
737a97c898
@ -361,12 +361,14 @@ class Generate:
|
|||||||
print(
|
print(
|
||||||
f'>> {len(results)} image(s) generated in', '%4.2fs' % (toc - tic)
|
f'>> {len(results)} image(s) generated in', '%4.2fs' % (toc - tic)
|
||||||
)
|
)
|
||||||
print(
|
if torch.cuda.is_available() and self.device.type == 'cuda':
|
||||||
f'>> Max VRAM used for this generation:',
|
print(
|
||||||
'%4.2fG' % (torch.cuda.max_memory_allocated() / 1e9),
|
f'>> Max VRAM used for this generation:',
|
||||||
)
|
'%4.2fG.' % (torch.cuda.max_memory_allocated() / 1e9),
|
||||||
|
'Current VRAM utilization:'
|
||||||
|
'%4.2fG' % (torch.cuda.memory_allocated() / 1e9),
|
||||||
|
)
|
||||||
|
|
||||||
if self.session_peakmem:
|
|
||||||
self.session_peakmem = max(
|
self.session_peakmem = max(
|
||||||
self.session_peakmem, torch.cuda.max_memory_allocated()
|
self.session_peakmem, torch.cuda.max_memory_allocated()
|
||||||
)
|
)
|
||||||
|
@ -130,8 +130,11 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile):
|
|||||||
command = get_next_command(infile)
|
command = get_next_command(infile)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
done = True
|
done = True
|
||||||
break
|
continue
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
done = True
|
||||||
|
continue
|
||||||
|
|
||||||
# skip empty lines
|
# skip empty lines
|
||||||
if not command.strip():
|
if not command.strip():
|
||||||
continue
|
continue
|
||||||
@ -182,6 +185,7 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile):
|
|||||||
continue
|
continue
|
||||||
if opt.seed is not None and opt.seed < 0: # retrieve previous value!
|
if opt.seed is not None and opt.seed < 0: # retrieve previous value!
|
||||||
try:
|
try:
|
||||||
|
print(f'last seeds = {last_seeds}, opt.seed={opt.seed}')
|
||||||
opt.seed = last_seeds[opt.seed]
|
opt.seed = last_seeds[opt.seed]
|
||||||
print(f'reusing previous seed {opt.seed}')
|
print(f'reusing previous seed {opt.seed}')
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -239,8 +243,8 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile):
|
|||||||
# Here is where the images are actually generated!
|
# Here is where the images are actually generated!
|
||||||
try:
|
try:
|
||||||
file_writer = PngWriter(current_outdir)
|
file_writer = PngWriter(current_outdir)
|
||||||
prefix = file_writer.unique_prefix()
|
prefix = file_writer.unique_prefix()
|
||||||
seeds = set()
|
seeds = list()
|
||||||
results = [] # list of filename, prompt pairs
|
results = [] # list of filename, prompt pairs
|
||||||
grid_images = dict() # seed -> Image, only used if `do_grid`
|
grid_images = dict() # seed -> Image, only used if `do_grid`
|
||||||
def image_writer(image, seed, upscaled=False):
|
def image_writer(image, seed, upscaled=False):
|
||||||
@ -272,7 +276,7 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile):
|
|||||||
# only append to results if we didn't overwrite an earlier output
|
# only append to results if we didn't overwrite an earlier output
|
||||||
results.append([path, metadata_prompt])
|
results.append([path, metadata_prompt])
|
||||||
|
|
||||||
seeds.add(seed)
|
seeds.append(seed)
|
||||||
|
|
||||||
t2i.prompt2image(image_callback=image_writer, **vars(opt))
|
t2i.prompt2image(image_callback=image_writer, **vars(opt))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user