yeq6x commited on
Commit
17e3bae
·
1 Parent(s): e126b30

with torch.autocast('cuda'):

Browse files
Files changed (1) hide show
  1. scripts/process_utils.py +19 -20
scripts/process_utils.py CHANGED
@@ -223,22 +223,23 @@ def generate_sotai_image(input_image: Image.Image, output_width: int, output_hei
223
  # EasyNegativeV2の内容
224
  easy_negative_v2 = "(worst quality, low quality, normal quality:1.4), lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry, artist name, (bad_prompt_version2:0.8)"
225
 
226
- output = sotai_gen_pipe(
227
- prompt,
228
- image=[input_image, input_image],
229
- negative_prompt=f"(wings:1.6), (clothes, garment, lighting, gray, missing limb, extra line, extra limb, extra arm, extra legs, hair, bangs, fringe, forelock, front hair, fill:1.4), (ink pool:1.6)",
230
- # negative_prompt=f"{easy_negative_v2}, (wings:1.6), (clothes, garment, lighting, gray, missing limb, extra line, extra limb, extra arm, extra legs, hair, bangs, fringe, forelock, front hair, fill:1.4), (ink pool:1.6)",
231
- num_inference_steps=20,
232
- guidance_scale=8,
233
- width=output_width,
234
- height=output_height,
235
- denoising_strength=0.13,
236
- num_images_per_prompt=1, # Equivalent to batch_size
237
- guess_mode=[True, True], # Equivalent to pixel_perfect
238
- controlnet_conditioning_scale=[1.4, 1.3], # 各ControlNetの重み
239
- guidance_start=[0.0, 0.0],
240
- guidance_end=[1.0, 1.0],
241
- )
 
242
  generated_image = output.images[0]
243
 
244
  return generated_image
@@ -312,12 +313,10 @@ def process_image(input_image, mode: str, weight1: float = 0.4, weight2: float =
312
  sketch_image = create_rgba_image(sketch_binary, [0, 0, 255])
313
 
314
  # 素体画像の生成
315
- with torch.autocast('cuda'):
316
- sotai_image = generate_sotai_image(refined_image, output_width, output_height)
317
 
318
  elif mode == "original":
319
- with torch.autocast('cuda'):
320
- sotai_image = generate_sotai_image(input_image, output_width, output_height)
321
 
322
  # スケッチ画像の生成
323
  input_image_np = np.array(input_image)
 
223
  # EasyNegativeV2の内容
224
  easy_negative_v2 = "(worst quality, low quality, normal quality:1.4), lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, jpeg artifacts, signature, watermark, username, blurry, artist name, (bad_prompt_version2:0.8)"
225
 
226
+ with torch.autocast('cuda'):
227
+ output = sotai_gen_pipe(
228
+ prompt,
229
+ image=[input_image, input_image],
230
+ negative_prompt=f"(wings:1.6), (clothes, garment, lighting, gray, missing limb, extra line, extra limb, extra arm, extra legs, hair, bangs, fringe, forelock, front hair, fill:1.4), (ink pool:1.6)",
231
+ # negative_prompt=f"{easy_negative_v2}, (wings:1.6), (clothes, garment, lighting, gray, missing limb, extra line, extra limb, extra arm, extra legs, hair, bangs, fringe, forelock, front hair, fill:1.4), (ink pool:1.6)",
232
+ num_inference_steps=20,
233
+ guidance_scale=8,
234
+ width=output_width,
235
+ height=output_height,
236
+ denoising_strength=0.13,
237
+ num_images_per_prompt=1, # Equivalent to batch_size
238
+ guess_mode=[True, True], # Equivalent to pixel_perfect
239
+ controlnet_conditioning_scale=[1.4, 1.3], # 各ControlNetの重み
240
+ guidance_start=[0.0, 0.0],
241
+ guidance_end=[1.0, 1.0],
242
+ )
243
  generated_image = output.images[0]
244
 
245
  return generated_image
 
313
  sketch_image = create_rgba_image(sketch_binary, [0, 0, 255])
314
 
315
  # 素体画像の生成
316
+ sotai_image = generate_sotai_image(refined_image, output_width, output_height)
 
317
 
318
  elif mode == "original":
319
+ sotai_image = generate_sotai_image(input_image, output_width, output_height)
 
320
 
321
  # スケッチ画像の生成
322
  input_image_np = np.array(input_image)