mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-18 22:08:13 +00:00
support edit_image_auto_resize
This commit is contained in:
@@ -22,5 +22,5 @@ image.save("image.jpg")
|
||||
|
||||
prompt = "将裙子变成粉色"
|
||||
image = image.resize((512, 384))
|
||||
image = pipe(prompt, edit_image=image, seed=1, num_inference_steps=40, height=1024, width=768, edit_rope_interpolation=True)
|
||||
image = pipe(prompt, edit_image=image, seed=1, num_inference_steps=40, height=1024, width=768, edit_rope_interpolation=True, edit_image_auto_resize=False)
|
||||
image.save(f"image2.jpg")
|
||||
|
||||
@@ -13,9 +13,14 @@ pipe = QwenImagePipeline.from_pretrained(
|
||||
processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
|
||||
)
|
||||
prompt = "精致肖像,水下少女,蓝裙飘逸,发丝轻扬,光影透澈,气泡环绕,面容恬静,细节精致,梦幻唯美。"
|
||||
image = pipe(prompt=prompt, seed=0, num_inference_steps=40, height=1024, width=1024)
|
||||
image.save("image1.jpg")
|
||||
input_image = pipe(prompt=prompt, seed=0, num_inference_steps=40, height=1328, width=1024)
|
||||
input_image.save("image1.jpg")
|
||||
|
||||
prompt = "将裙子改为粉色"
|
||||
image = pipe(prompt, edit_image=image, seed=1, num_inference_steps=40, height=1024, width=1024)
|
||||
# edit_image_auto_resize=True: auto resize input image to match the area of 1024*1024 with the original aspect ratio
|
||||
# edit_image_auto_resize=False: do not resize input image
|
||||
image = pipe(prompt, edit_image=input_image, seed=1, num_inference_steps=40, height=1328, width=1024, edit_image_auto_resize=True)
|
||||
image.save(f"image2.jpg")
|
||||
|
||||
image = pipe(prompt, edit_image=input_image, seed=1, num_inference_steps=40, height=1328, width=1024, edit_image_auto_resize=False)
|
||||
image.save(f"image3.jpg")
|
||||
|
||||
@@ -24,5 +24,5 @@ image.save("image.jpg")
|
||||
|
||||
prompt = "将裙子变成粉色"
|
||||
image = image.resize((512, 384))
|
||||
image = pipe(prompt, edit_image=image, seed=1, num_inference_steps=40, height=1024, width=768, edit_rope_interpolation=True)
|
||||
image = pipe(prompt, edit_image=image, seed=1, num_inference_steps=40, height=1024, width=768, edit_rope_interpolation=True, edit_image_auto_resize=False)
|
||||
image.save(f"image2.jpg")
|
||||
|
||||
@@ -78,6 +78,7 @@ class QwenImageTrainingModule(DiffusionTrainingModule):
|
||||
"rand_device": self.pipe.device,
|
||||
"use_gradient_checkpointing": self.use_gradient_checkpointing,
|
||||
"use_gradient_checkpointing_offload": self.use_gradient_checkpointing_offload,
|
||||
"edit_image_auto_resize": True,
|
||||
}
|
||||
|
||||
# Extra inputs
|
||||
|
||||
Reference in New Issue
Block a user