Skip to content

Commit 5f7a465

Browse files
authored
Merge pull request #181 from intel/testcase_update_forsdxl
Fixing SDXL guidance scale and image write.
2 parents 1648164 + d603145 commit 5f7a465

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

testscases/StableDiffusion/stable_diffusion_engine_tc.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,9 @@ def parse_args() -> argparse.Namespace:
203203
args.add_argument('-pp','--prompt',type = str,
204204
default ="a portrait of an old coal miner in 19th century, beautiful painting with highly detailed face by greg rutkowski and magali villanueve",
205205
required = False,
206-
#help='Optional. Specify the prompt. Default: "a bowl of cherries"')
207206
help='Optional. Specify the prompt. Default: "castle surrounded by water and nature, village, volumetric lighting, photorealistic, detailed and intricate, fantasy, epic cinematic shot, mountains, 8k ultra hd"')
208-
args.add_argument('-np','--neg_prompt',type = str, default = "deformed face, Ugly, bad quality, lowres, monochrome, bad anatomy", required = False,
209-
help='Optional. Specify the negative prompt. Default: "low quality, bad, low resolution, monochrome"')
207+
args.add_argument('-np','--neg_prompt',type = str, default = None , required=False,
208+
help='Optional. Specify the negative prompt. Default: None')
210209

211210
return parser.parse_args()
212211

@@ -258,6 +257,7 @@ def main():
258257
model_path = os.path.join(weight_path, *model_paths.get(model_name))
259258
model_config_file_name = os.path.join(model_path, "config.json")
260259

260+
261261
try:
262262
if args.power_mode is not None and os.path.exists(model_config_file_name):
263263
with open(model_config_file_name, 'r') as file:
@@ -290,6 +290,10 @@ def main():
290290
log.info('')
291291
log.info('Initializing Inference Engine...')
292292
log.info('Model Path: %s',model_path )
293+
294+
if "turbo" in model_name and args.guidance_scale > 1.0:
295+
log.warning(f"Max guidance scale for {model_name} is 1.0, adjusting {args.guidance_scale} down to 1.0")
296+
args.guidance_scale = 1.0
293297

294298
prompt = args.prompt #"a beautiful artwork illustration, concept art sketch of an astronaut in white futuristic cybernetic armor in a dark cave, volumetric fog, godrays, high contrast, vibrant colors, vivid colors, high saturation, by Greg Rutkowski and Jesper Ejsing and Raymond Swanland and alena aenami, featured on artstation, wide angle, vertical orientation"
295299
negative_prompt = args.neg_prompt # "lowres, bad quality, monochrome, cropped head, deformed face, bad anatomy"
@@ -456,7 +460,7 @@ def main():
456460
if args.save_image:
457461
index = 1
458462
for result in results:
459-
if "sd_3.0" not in model_name and "lcm" not in model_name:
463+
if "sd_3.0" not in model_name and "lcm" not in model_name and "sdxl" not in model_name:
460464
cv2.imwrite(result[1] + "_" + str(index) + ".jpg", result[0])
461465
else:
462466
result[0].save(result[1] + "_" + str(index) + ".jpg")

0 commit comments

Comments
 (0)