@ -11,9 +11,8 @@ import cv2
from skimage import exposure
from skimage import exposure
import modules . sd_hijack
import modules . sd_hijack
from modules import devices , prompt_parser , masking
from modules import devices , prompt_parser , masking , sd_samplers
from modules . sd_hijack import model_hijack
from modules . sd_hijack import model_hijack
from modules . sd_samplers import samplers , samplers_for_img2img
from modules . shared import opts , cmd_opts , state
from modules . shared import opts , cmd_opts , state
import modules . shared as shared
import modules . shared as shared
import modules . face_restoration
import modules . face_restoration
@ -110,7 +109,7 @@ class Processed:
self . width = p . width
self . width = p . width
self . height = p . height
self . height = p . height
self . sampler_index = p . sampler_index
self . sampler_index = p . sampler_index
self . sampler = s amplers[ p . sampler_index ] . name
self . sampler = s d_samplers. s amplers[ p . sampler_index ] . name
self . cfg_scale = p . cfg_scale
self . cfg_scale = p . cfg_scale
self . steps = p . steps
self . steps = p . steps
self . batch_size = p . batch_size
self . batch_size = p . batch_size
@ -265,7 +264,7 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration
generation_params = {
generation_params = {
" Steps " : p . steps ,
" Steps " : p . steps ,
" Sampler " : s amplers[ p . sampler_index ] . name ,
" Sampler " : s d_samplers. s amplers[ p . sampler_index ] . name ,
" CFG scale " : p . cfg_scale ,
" CFG scale " : p . cfg_scale ,
" Seed " : all_seeds [ index ] ,
" Seed " : all_seeds [ index ] ,
" Face restoration " : ( opts . face_restoration_model if p . restore_faces else None ) ,
" Face restoration " : ( opts . face_restoration_model if p . restore_faces else None ) ,
@ -478,7 +477,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
self . firstphase_height_truncated = int ( scale * self . height )
self . firstphase_height_truncated = int ( scale * self . height )
def sample ( self , conditioning , unconditional_conditioning , seeds , subseeds , subseed_strength ) :
def sample ( self , conditioning , unconditional_conditioning , seeds , subseeds , subseed_strength ) :
self . sampler = s amplers[ self . sampler_index ] . constructor ( self . sd_model )
self . sampler = s d_samplers. s amplers[ self . sampler_index ] . constructor ( self . sd_model )
if not self . enable_hr :
if not self . enable_hr :
x = create_random_tensors ( [ opt_C , self . height / / opt_f , self . width / / opt_f ] , seeds = seeds , subseeds = subseeds , subseed_strength = self . subseed_strength , seed_resize_from_h = self . seed_resize_from_h , seed_resize_from_w = self . seed_resize_from_w , p = self )
x = create_random_tensors ( [ opt_C , self . height / / opt_f , self . width / / opt_f ] , seeds = seeds , subseeds = subseeds , subseed_strength = self . subseed_strength , seed_resize_from_h = self . seed_resize_from_h , seed_resize_from_w = self . seed_resize_from_w , p = self )
@ -521,7 +520,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
shared . state . nextjob ( )
shared . state . nextjob ( )
self . sampler = s amplers[ self . sampler_index ] . constructor ( self . sd_model )
self . sampler = s d_samplers. s amplers[ self . sampler_index ] . constructor ( self . sd_model )
noise = create_random_tensors ( samples . shape [ 1 : ] , seeds = seeds , subseeds = subseeds , subseed_strength = subseed_strength , seed_resize_from_h = self . seed_resize_from_h , seed_resize_from_w = self . seed_resize_from_w , p = self )
noise = create_random_tensors ( samples . shape [ 1 : ] , seeds = seeds , subseeds = subseeds , subseed_strength = subseed_strength , seed_resize_from_h = self . seed_resize_from_h , seed_resize_from_w = self . seed_resize_from_w , p = self )
# GC now before running the next img2img to prevent running out of memory
# GC now before running the next img2img to prevent running out of memory
@ -556,7 +555,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self . nmask = None
self . nmask = None
def init ( self , all_prompts , all_seeds , all_subseeds ) :
def init ( self , all_prompts , all_seeds , all_subseeds ) :
self . sampler = s amplers_for_img2img[ self . sampler_index ] . constructor ( self . sd_model )
self . sampler = s d_samplers. s amplers_for_img2img[ self . sampler_index ] . constructor ( self . sd_model )
crop_region = None
crop_region = None
if self . image_mask is not None :
if self . image_mask is not None :