remove unused code

This commit is contained in:
Kelly Jerrell
2025-06-17 00:22:44 -07:00
parent 9b26a10f3a
commit bcd4bfae6f
+6 -136
View File
@@ -251,142 +251,12 @@ def apply_conditional(config: Config, configT: GenerationConfigurationT):
if model.sdxl:
if "height" in config:
configT.originalImageHeight = config['height']
configT.targetImageHeight = config['height']
configT.negativeOriginalImageHeight = config['height'] // 2
configT.originalImageHeight = config["height"]
configT.targetImageHeight = config["height"]
configT.negativeOriginalImageHeight = config["height"] // 2
if "width" in config:
configT.originalImageWidth = config['width']
configT.targetImageWidth = config['width']
configT.negativeOriginalImageWidth = config['width'] // 2
# stochastic_sampling_gamma
def coerce_common(config: Config, configT: GenerationConfigurationT):
if "start_width" in config:
configT.startWidth = round_by_64(clamp(config["start_width"]))
if "start_height" in config:
configT.startHeight = round_by_64(clamp(config["start_height"]))
if "seed" in config:
configT.seed = int(config["seed"] % 4294967295)
if "seed_mode" in config:
configT.seedMode = DrawThingsLists.seed_mode.index(config["seed_mode"]) or 0
if "steps" in config:
configT.steps = clamp(config["steps"], 1, 150)
if "guidance_scale" in config:
configT.guidanceScale = clamp_f(config["guidance_scale"], 0, 50)
if "strength" in config:
configT.strength = clamp_f(config["strength"], 0, 1)
if "sampler" in config:
configT.sampler = DrawThingsLists.sampler_list.index(config["sampler"]) or 0
if "batch_count" in config:
configT.batchCount = clamp(config["batch_count"], 1, 4)
if "batch_size" in config:
configT.batchSize = clamp(config["batch_size"], 1, 1)
if "clip_skip" in config:
configT.clipSkip = clamp(config["clip_skip"], 1, 23)
if "mask_blur" in config:
configT.maskBlur = clamp_f(config["mask_blur"], 0, 15)
if "mask_blur_outset" in config:
configT.maskBlurOutset = clamp(config["mask_blur_outset"], -100, 100)
if "sharpness" in config:
configT.sharpness = clamp_f(config["sharpness"], 0, 30)
if "shift" in config:
configT.shift = clamp_f(config["shift"], 0.1, 8)
if "preserve_original_after_inpaint" in config:
configT.preserveOriginalAfterInpaint = bool(
config["preserve_original_after_inpaint"]
)
if "resolution_dependent_shift" in config:
configT.resolutionDependentShift = bool(config["resolution_dependent_shift"])
if "image_guidance_scale" in config:
configT.imageGuidanceScale = clamp_f(config["image_guidance_scale"], 0, 50)
def coerce_conditional(config: Config, configT: GenerationConfigurationT):
if config.get("hires_fix"):
configT.hiresFix = True
if "hires_fix_start_width" in config:
configT.hiresFixStartWidth = round_by_64(
clamp(config["hires_fix_start_width"])
)
if "hires_fix_start_height" in config:
configT.hiresFixStartHeight = round_by_64(
clamp(config["hires_fix_start_height"])
)
if "hires_fix_strength" in config:
configT.hiresFixStrength = clamp_f(config["hires_fix_strength"], 0, 1)
if config.get("tiled_decoding"):
configT.tiledDecoding = True
if "decoding_tile_width" in config:
configT.decodingTileWidth = round_by_64(
clamp(config["decoding_tile_width"])
)
if "decoding_tile_height" in config:
configT.decodingTileHeight = round_by_64(
clamp(config["decoding_tile_height"])
)
if "decoding_tile_overlap" in config:
configT.decodingTileOverlap = round_by_64(
clamp(config["decoding_tile_overlap"], max_val=1024)
)
if config.get("tiled_diffusion"):
configT.tiledDiffusion = True
if "diffusion_tile_width" in config:
configT.diffusionTileWidth = round_by_64(
clamp(config["diffusion_tile_width"])
)
if "diffusion_tile_height" in config:
configT.diffusionTileHeight = round_by_64(
clamp(config["diffusion_tile_height"])
)
if "diffusion_tile_overlap" in config:
configT.diffusionTileOverlap = round_by_64(
clamp(config["diffusion_tile_overlap"], max_val=1024)
)
# separate_clip_l
# clip_l_text
if config.get("separate_clip_l"):
configT.separateClipL = True
if "clip_l_text" in config:
configT.clipLText = str(config["clip_l_text"])
# separate_open_clip_g
# open_clip_g_text
if config.get("separate_open_clip_g"):
configT.separateOpenClipG = True
if "open_clip_g_text" in config:
configT.openClipGText = str(config["open_clip_g_text"])
# speed_up_with_guidance_embed
if not config.get("speed_up_with_guidance_embed"):
configT.speedUpWithGuidanceEmbed = False
if "guidance_embed" in config:
configT.guidanceEmbed = clamp_f(config["guidance_embed"], 0, 50)
# tea_cache_start
# tea_cache_end
# tea_cache_threshold
# tea_cache
# tea_cache_max_skip_steps
if config.get("tea_cache"):
configT.teaCache = True
if (
"tea_cache_start" in config
and "tea_cache_end" in config
and "steps" in config
):
steps = config["steps"]
a = clamp(config["tea_cache_start"], 0, steps)
b = clamp(config["tea_cache_end"], 0, steps)
configT.teaCacheStart = min(a, b)
configT.teaCacheEnd = max(a, b)
if "tea_cache_threshold" in config:
configT.teaCacheThreshold = config["tea_cache_threshold"]
if "tea_cache_max_skip_steps" in config:
configT.teaCacheMaxSkipSteps = config["tea_cache_max_skip_steps"]
configT.originalImageWidth = config["width"]
configT.targetImageWidth = config["width"]
configT.negativeOriginalImageWidth = config["width"] // 2
# stochastic_sampling_gamma