Views
No views yet
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .pip install diffsynth1from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
2from PIL import Image
3import torch
4
5pipe = QwenImagePipeline.from_pretrained(
6 torch_dtype=torch.bfloat16,
7 device="cuda",
8 model_configs=[
9 ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
10 ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
11 ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
12 ],
13 tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"),
14)
15prompt = "A detailed portrait of a girl underwater, wearing a blue flowing dress, hair gently floating, clear light and shadow, surrounded by bubbles, calm expression, fine details, dreamy and beautiful."
16image = pipe(
17 prompt, seed=0, num_inference_steps=40,
18 # edit_image=Image.open("xxx.jpg").resize((1328, 1328)) # For Qwen-Image-Edit
19)
20image.save("image.jpg")1import torch
2from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig
3
4pipe = FluxImagePipeline.from_pretrained(
5 torch_dtype=torch.bfloat16,
6 device="cuda",
7 model_configs=[
8 ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="flux1-dev.safetensors"),
9 ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"),
10 ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"),
11 ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"),
12 ],
13)
14
15image = pipe(prompt="a cat", seed=0)
16image.save("image.jpg")1import torch
2from diffsynth import save_video
3from diffsynth.pipelines.wan_video_new import WanVideoPipeline, ModelConfig
4
5pipe = WanVideoPipeline.from_pretrained(
6 torch_dtype=torch.bfloat16,
7 device="cuda",
8 model_configs=[
9 ModelConfig(model_id="Wan-AI/Wan2.1-T2V-1.3B", origin_file_pattern="diffusion_pytorch_model*.safetensors", offload_device="cpu"),
10 ModelConfig(model_id="Wan-AI/Wan2.1-T2V-1.3B", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.pth", offload_device="cpu"),
11 ModelConfig(model_id="Wan-AI/Wan2.1-T2V-1.3B", origin_file_pattern="Wan2.1_VAE.pth", offload_device="cpu"),
12 ],
13)
14pipe.enable_vram_management()
15
16video = pipe(
17 prompt="A documentary photography style scene: a lively puppy rapidly running on green grass. The puppy has brown-yellow fur, upright ears, and looks focused and joyful. Sunlight shines on its body, making the fur appear soft and shiny. The background is an open field with occasional wildflowers, and faint blue sky and clouds in the distance. Strong sense of perspective captures the motion of the puppy and the vitality of the surrounding grass. Mid-shot side-moving view.",
18 negative_prompt="Bright colors, overexposed, static, blurry details, subtitles, style, artwork, image, still, overall gray, worst quality, low quality, JPEG compression artifacts, ugly, deformed, extra fingers, poorly drawn hands, poorly drawn face, malformed limbs, fused fingers, still frame, messy background, three legs, crowded background people, walking backwards",
19 seed=0, tiled=True,
20)
21save_video(video, "video1.mp4", fps=15, quality=5)| FLUX | Stable Diffusion 3 |
|---|---|
| Kolors | Hunyuan-DiT |
|---|---|
| Stable Diffusion | Stable Diffusion XL |
|---|---|

| FLUX.1-dev | FLUX.1-dev + ArtAug LoRA |
|---|---|
| Entity Control Mask | Generated Image |
|---|---|
1024 x 1024 images. It includes the general, English text rendering, and Chinese text rendering subsets. We provide caption, entity and control images annotations for each image. Developers can use this dataset to train models such as ControlNet and EliGen for the Qwen-Image model. We aim to promote technological development through open-source contributions!./examples/ControlNet/.examples/ExVideo.