Replies: 1 comment 5 replies
-
Could you try with |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
webui result:
diffusers result:
Why did the human face change, I did not mask the face part.
This is my code:
def make_inpaint_condition(image, image_mask):
image = np.array(image.convert("RGB")).astype(np.float32) / 255.0
image_mask = np.array(image_mask.convert("L")).astype(np.float32) / 255.0
init_image = load_image("./init_image.jpg")
init_image = init_image.resize((512, 512))
mask_image = load_image("./mask_image.jpg")
mask_image = mask_image.resize((512, 512))
control_image = make_inpaint_condition(init_image, mask_image)
controlnet = ControlNetModel.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True
)
pipe.load_lora_weights("/cloudfs-data/visiondata/mmy/diffusers", weight_name="sd_lora_lbx_1e4.safetensors")
pipe.fuse_lora(lora_scale=0.9)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
pipe.enable_xformers_memory_efficient_attention()
pipe.to("cuda:3")
prompt = "a man is wearing brown safety shoes with multiple laces and a rugged sole"
negative_prompt="cartoon, painting, deformed, illustration, (worst quality, low quality, normal quality:2), (disconnected limbs:1.5), busty, (epicnegative:0.9), nsfw, (extra limb:1.5), (mutated hands and fingers), (poorly drawn hands)"
output = pipe(
prompt,
width=512,
height=512,
num_inference_steps=25,
negative_prompt=negative_prompt,
eta=1.0,
image=init_image,
mask_image=mask_image,
control_image=control_image,
).images[0]
Beta Was this translation helpful? Give feedback.
All reactions