mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-24 10:18:12 +00:00
add examples
This commit is contained in:
@@ -766,9 +766,9 @@ DiffSynth-Studio is not just an engineered model framework, but also an incubato
|
|||||||
|
|
||||||
- Paper: [Spectral Evolution Search: Efficient Inference-Time Scaling for Reward-Aligned Image Generation
|
- Paper: [Spectral Evolution Search: Efficient Inference-Time Scaling for Reward-Aligned Image Generation
|
||||||
](https://arxiv.org/abs/2602.03208)
|
](https://arxiv.org/abs/2602.03208)
|
||||||
- Sample Code: []()
|
- Sample Code: coming soon
|
||||||
|
|
||||||
|FLUX|FLUX + SES|Qwen-Image|Qwen-Image + SES|
|
|FLUX.1-dev|FLUX.1-dev + SES|Qwen-Image|Qwen-Image + SES|
|
||||||
|-|-|-|-|
|
|-|-|-|-|
|
||||||
|||||
|
|||||
|
||||||
|
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ DiffSynth-Studio 不仅仅是一个工程化的模型框架,更是创新成果
|
|||||||
|
|
||||||
- 论文:[Spectral Evolution Search: Efficient Inference-Time Scaling for Reward-Aligned Image Generation
|
- 论文:[Spectral Evolution Search: Efficient Inference-Time Scaling for Reward-Aligned Image Generation
|
||||||
](https://arxiv.org/abs/2602.03208)
|
](https://arxiv.org/abs/2602.03208)
|
||||||
- 代码样例:[]()
|
- 代码样例:coming soon
|
||||||
|
|
||||||
|FLUX.1-dev|FLUX.1-dev + SES|Qwen-Image|Qwen-Image + SES|
|
|FLUX.1-dev|FLUX.1-dev + SES|Qwen-Image|Qwen-Image + SES|
|
||||||
|-|-|-|-|
|
|-|-|-|-|
|
||||||
@@ -774,6 +774,7 @@ DiffSynth-Studio 不仅仅是一个工程化的模型框架,更是创新成果
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<summary>VIRAL:基于DiT模型的类比视觉上下文推理</summary>
|
<summary>VIRAL:基于DiT模型的类比视觉上下文推理</summary>
|
||||||
@@ -789,6 +790,7 @@ DiffSynth-Studio 不仅仅是一个工程化的模型框架,更是创新成果
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<summary>AttriCtrl: 图像生成模型的属性强度控制</summary>
|
<summary>AttriCtrl: 图像生成模型的属性强度控制</summary>
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
|
||||||
|
from modelscope import snapshot_download
|
||||||
|
from PIL import Image
|
||||||
|
import torch
|
||||||
|
|
||||||
|
# Load models
|
||||||
|
vram_config = {
|
||||||
|
"offload_dtype": "disk",
|
||||||
|
"offload_device": "disk",
|
||||||
|
"onload_dtype": torch.float8_e4m3fn,
|
||||||
|
"onload_device": "cpu",
|
||||||
|
"preparing_dtype": torch.float8_e4m3fn,
|
||||||
|
"preparing_device": "cuda",
|
||||||
|
"computation_dtype": torch.bfloat16,
|
||||||
|
"computation_device": "cuda",
|
||||||
|
}
|
||||||
|
pipe = QwenImagePipeline.from_pretrained(
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
device="cuda",
|
||||||
|
model_configs=[
|
||||||
|
ModelConfig(model_id="Qwen/Qwen-Image-Edit-2511", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors", **vram_config),
|
||||||
|
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors", **vram_config),
|
||||||
|
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors", **vram_config),
|
||||||
|
],
|
||||||
|
processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
|
||||||
|
)
|
||||||
|
|
||||||
|
lora = ModelConfig(
|
||||||
|
model_id="DiffSynth-Studio/Qwen-Image-Edit-2511-ICEdit-LoRA",
|
||||||
|
origin_file_pattern="model.safetensors"
|
||||||
|
)
|
||||||
|
pipe.load_lora(pipe.dit, lora)
|
||||||
|
|
||||||
|
# Load images
|
||||||
|
snapshot_download(
|
||||||
|
"DiffSynth-Studio/Qwen-Image-Edit-2511-ICEdit-LoRA",
|
||||||
|
local_dir="./data",
|
||||||
|
allow_file_pattern="assets/*"
|
||||||
|
)
|
||||||
|
edit_image = [
|
||||||
|
Image.open("data/assets/image1_original.png"),
|
||||||
|
Image.open("data/assets/image1_edit_1.png"),
|
||||||
|
Image.open("data/assets/image2_original.png")
|
||||||
|
]
|
||||||
|
prompt = "Edit image 3 based on the transformation from image 1 to image 2."
|
||||||
|
negative_prompt = "泛黄,AI感,不真实,丑陋,油腻的皮肤,异常的肢体,不协调的肢体"
|
||||||
|
|
||||||
|
# Generate
|
||||||
|
image_4 = pipe(
|
||||||
|
prompt=prompt, negative_prompt=negative_prompt,
|
||||||
|
edit_image=edit_image,
|
||||||
|
seed=1,
|
||||||
|
num_inference_steps=50,
|
||||||
|
height=1280,
|
||||||
|
width=720,
|
||||||
|
zero_cond_t=True,
|
||||||
|
)
|
||||||
|
image_4.save("image.png")
|
||||||
Reference in New Issue
Block a user