diff --git a/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.0.py b/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.0.py index 3c0d07b4c..c95bb0591 100644 --- a/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.0.py +++ b/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.0.py @@ -2,6 +2,7 @@ from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from diffsynth import load_state_dict +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -17,6 +18,12 @@ state_dict = load_state_dict("models/train/FireRed-Image-Edit-1.0_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.1.py b/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.1.py index 02801dc98..5a73a6156 100644 --- a/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.1.py +++ b/examples/qwen_image/model_training/validate_full/FireRed-Image-Edit-1.1.py @@ -2,6 +2,7 @@ from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from diffsynth import load_state_dict +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -17,6 +18,12 @@ state_dict = load_state_dict("models/train/FireRed-Image-Edit-1.1_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2509.py b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2509.py index 9295904ca..dd62fe9ef 100644 --- a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2509.py +++ b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2509.py @@ -2,6 +2,7 @@ from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from diffsynth import load_state_dict +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -17,6 +18,12 @@ state_dict = load_state_dict("models/train/Qwen-Image-Edit-2509_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2511.py b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2511.py index c94dadc54..21f1da9a1 100644 --- a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2511.py +++ b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit-2511.py @@ -2,6 +2,7 @@ from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from diffsynth import load_state_dict +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -17,6 +18,12 @@ state_dict = load_state_dict("models/train/Qwen-Image-Edit-2511_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit.py b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit.py index c08b4850c..04fc5356c 100644 --- a/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit.py +++ b/examples/qwen_image/model_training/validate_full/Qwen-Image-Edit.py @@ -2,6 +2,7 @@ from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig from diffsynth import load_state_dict +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -17,6 +18,12 @@ state_dict = load_state_dict("models/train/Qwen-Image-Edit_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/image1.jpg" +) + prompt = "将裙子改为粉色" image = Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)) image = pipe(prompt, edit_image=image, seed=0, num_inference_steps=40, height=1024, width=1024) diff --git a/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered-Control.py b/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered-Control.py index 961904f93..eec5f85d9 100644 --- a/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered-Control.py +++ b/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered-Control.py @@ -2,6 +2,7 @@ from diffsynth import load_state_dict from PIL import Image import torch +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -16,6 +17,12 @@ ) state_dict = load_state_dict("models/train/Qwen-Image-Layered-Control_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) + +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="layer/image.png" +) prompt = "Text 'HELLO' and 'Have a great day'" input_image = Image.open("data/example_image_dataset/layer/image.png").convert("RGBA").resize((864, 480)) images = pipe( diff --git a/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered.py b/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered.py index dc845498b..08162909a 100644 --- a/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered.py +++ b/examples/qwen_image/model_training/validate_full/Qwen-Image-Layered.py @@ -2,6 +2,7 @@ from diffsynth import load_state_dict from PIL import Image import torch +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -16,6 +17,12 @@ ) state_dict = load_state_dict("models/train/Qwen-Image-Layered_full/epoch-1.safetensors") pipe.dit.load_state_dict(state_dict) + +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="layer/image.png" +) prompt = "a poster" input_image = Image.open("data/example_image_dataset/layer/image.png").convert("RGBA").resize((864, 480)) images = pipe( diff --git a/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.0.py b/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.0.py index b5b0046e1..15633d0cf 100644 --- a/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.0.py +++ b/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.0.py @@ -1,6 +1,7 @@ import torch from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/FireRed-Image-Edit-1.0_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.1.py b/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.1.py index 234105ba3..cf1a2042c 100644 --- a/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.1.py +++ b/examples/qwen_image/model_training/validate_lora/FireRed-Image-Edit-1.1.py @@ -1,6 +1,7 @@ import torch from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/FireRed-Image-Edit-1.1_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2509.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2509.py index e701b0749..f1656b47a 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2509.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2509.py @@ -1,6 +1,7 @@ import torch from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Edit-2509_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2511.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2511.py index 0cd0fc7bd..4db3e93a4 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2511.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit-2511.py @@ -1,6 +1,7 @@ import torch from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Edit-2511_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/*.jpg" +) + prompt = "Change the color of the dress in Figure 1 to the color shown in Figure 2." images = [ Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)), diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit.py index 2576be339..b090c4257 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Edit.py @@ -1,6 +1,7 @@ import torch from PIL import Image from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Edit_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="edit/image1.jpg" +) + prompt = "将裙子改为粉色" image = Image.open("data/example_image_dataset/edit/image1.jpg").resize((1024, 1024)) image = pipe(prompt, edit_image=image, seed=0, num_inference_steps=40, height=1024, width=1024) diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen-Poster.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen-Poster.py index 81f697c40..5ffb7daf9 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen-Poster.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen-Poster.py @@ -1,6 +1,7 @@ from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig import torch from PIL import Image +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-EliGen-Poster_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="eligen/*.png" +) + entity_prompts = ["A beautiful girl", "sign 'Entity Control'", "shorts", "shirt"] global_prompt = "A beautiful girl wearing shirt and shorts in the street, holding a sign 'Entity Control'" diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen.py index cd7904e9d..fa123024b 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-EliGen.py @@ -1,6 +1,7 @@ from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig import torch from PIL import Image +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -15,6 +16,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-EliGen_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="eligen/*.png" +) + entity_prompts = ["A beautiful girl", "sign 'Entity Control'", "shorts", "shirt"] global_prompt = "A beautiful girl wearing shirt and shorts in the street, holding a sign 'Entity Control'" diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-In-Context-Control-Union.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-In-Context-Control-Union.py index 83a93a3f6..b115aa31d 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-In-Context-Control-Union.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-In-Context-Control-Union.py @@ -1,6 +1,7 @@ from PIL import Image import torch from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( torch_dtype=torch.bfloat16, @@ -13,6 +14,12 @@ tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"), ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-In-Context-Control-Union_lora/epoch-4.safetensors") + +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="canny/image_1.jpg" +) image = Image.open("data/example_image_dataset/canny/image_1.jpg").resize((1024, 1024)) prompt = "Context_Control. a dog" image = pipe(prompt=prompt, seed=0, context_image=image, height=1024, width=1024) diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control-V2.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control-V2.py index 3aa7ac4e4..59b26967a 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control-V2.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control-V2.py @@ -15,6 +15,12 @@ ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Layered-Control-V2_lora/epoch-4.safetensors") +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="layer_v2/*.png" +) + prompt = "Text 'APRIL'" input_image = Image.open("data/example_image_dataset/layer_v2/image_1.png").convert("RGBA").resize((1024, 1024)) image = pipe( diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control.py index 1a96e8b43..0f968f8f2 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered-Control.py @@ -2,6 +2,7 @@ from diffsynth import load_state_dict from PIL import Image import torch +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -15,6 +16,12 @@ tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"), ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Layered-Control_lora/epoch-4.safetensors") + +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="layer/image.png" +) prompt = "Text 'HELLO' and 'Have a great day'" input_image = Image.open("data/example_image_dataset/layer/image.png").convert("RGBA").resize((864, 480)) images = pipe( diff --git a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered.py b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered.py index 4ae4c8b6c..a0e91bc11 100644 --- a/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered.py +++ b/examples/qwen_image/model_training/validate_lora/Qwen-Image-Layered.py @@ -2,6 +2,7 @@ from diffsynth import load_state_dict from PIL import Image import torch +from modelscope import dataset_snapshot_download pipe = QwenImagePipeline.from_pretrained( @@ -15,6 +16,12 @@ tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"), ) pipe.load_lora(pipe.dit, "models/train/Qwen-Image-Layered_lora/epoch-4.safetensors") + +dataset_snapshot_download( + dataset_id="DiffSynth-Studio/example_image_dataset", + local_dir="./data/example_image_dataset", + allow_file_pattern="layer/image.png" +) prompt = "a poster" input_image = Image.open("data/example_image_dataset/layer/image.png").convert("RGBA").resize((864, 480)) images = pipe(