@ -100,7 +100,7 @@ class StableDiffusionProcessing:
class Processed :
def __init__ ( self , p : StableDiffusionProcessing , images_list , seed = - 1 , info = " " , subseed = None , all_prompts = None , all_seeds = None , all_subseeds = None , index_of_first_image = 0 ):
def __init__ ( self , p : StableDiffusionProcessing , images_list , seed = - 1 , info = " " , subseed = None , all_prompts = None , all_seeds = None , all_subseeds = None , index_of_first_image = 0 , infotexts = None ):
self . images = images_list
self . prompt = p . prompt
self . negative_prompt = p . negative_prompt
@ -139,6 +139,7 @@ class Processed:
self . all_prompts = all_prompts or [ self . prompt ]
self . all_seeds = all_seeds or [ self . seed ]
self . all_subseeds = all_subseeds or [ self . subseed ]
self . infotexts = infotexts or [ info ]
def js ( self ) :
obj = {
@ -165,6 +166,7 @@ class Processed:
" denoising_strength " : self . denoising_strength ,
" extra_generation_params " : self . extra_generation_params ,
" index_of_first_image " : self . index_of_first_image ,
" infotexts " : self . infotexts ,
}
return json . dumps ( obj )
@ -322,6 +324,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
if os . path . exists ( cmd_opts . embeddings_dir ) :
model_hijack . load_textual_inversion_embeddings ( cmd_opts . embeddings_dir , p . sd_model )
infotexts = [ ]
output_images = [ ]
precision_scope = torch . autocast if cmd_opts . precision == " autocast " else contextlib . nullcontext
ema_scope = ( contextlib . nullcontext if cmd_opts . lowvram else p . sd_model . ema_scope )
@ -404,6 +407,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
if opts . samples_save and not p . do_not_save_samples :
images . save_image ( image , p . outpath_samples , " " , seeds [ i ] , prompts [ i ] , opts . samples_format , info = infotext ( n , i ) , p = p )
infotexts . append ( infotext ( n , i ) )
output_images . append ( image )
state . nextjob ( )
@ -416,6 +420,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
grid = images . image_grid ( output_images , p . batch_size )
if opts . return_grid :
infotexts . insert ( 0 , infotext ( ) )
output_images . insert ( 0 , grid )
index_of_first_image = 1
@ -423,7 +428,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
images . save_image ( grid , p . outpath_grids , " grid " , all_seeds [ 0 ] , all_prompts [ 0 ] , opts . grid_format , info = infotext ( ) , short_filename = not opts . grid_extended_filename , p = p , grid = True )
devices . torch_gc ( )
return Processed ( p , output_images , all_seeds [ 0 ] , infotext ( ) , subseed = all_subseeds [ 0 ] , all_prompts = all_prompts , all_seeds = all_seeds , all_subseeds = all_subseeds , index_of_first_image = index_of_first_image )
return Processed ( p , output_images , all_seeds [ 0 ] , infotext ( ) , subseed = all_subseeds [ 0 ] , all_prompts = all_prompts , all_seeds = all_seeds , all_subseeds = all_subseeds , index_of_first_image = index_of_first_image , infotexts = infotexts )
class StableDiffusionProcessingTxt2Img ( StableDiffusionProcessing ) :