mirror of
https://github.com/modelscope/DiffSynth-Studio.git
synced 2026-03-21 16:18:13 +00:00
update examples and downloaders
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
from diffsynth import ModelManager, SDImagePipeline, SDVideoPipeline, ControlNetConfigUnit, VideoData, save_video, save_frames
|
||||
from diffsynth import ModelManager, SDImagePipeline, SDVideoPipeline, save_video, download_models
|
||||
from diffsynth.extensions.RIFE import RIFEInterpolater
|
||||
import torch
|
||||
|
||||
|
||||
# Download models
|
||||
# Download models (automatically)
|
||||
# `models/stable_diffusion/dreamshaper_8.safetensors`: [link](https://civitai.com/api/download/models/128713?type=Model&format=SafeTensor&size=pruned&fp=fp16)
|
||||
# `models/AnimateDiff/mm_sd_v15_v2.ckpt`: [link](https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15_v2.ckpt)
|
||||
# `models/RIFE/flownet.pkl`: [link](https://drive.google.com/file/d/1APIzVeI-4ZZCEuIRE1m6WYfSCaOsi_7_/view?usp=sharing)
|
||||
|
||||
download_models(["DreamShaper_8", "AnimateDiff_v2", "RIFE"])
|
||||
|
||||
# Load models
|
||||
model_manager = ModelManager(torch_dtype=torch.float16, device="cuda")
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from diffsynth import ModelManager, SDXLVideoPipeline, save_video
|
||||
from diffsynth import ModelManager, SDXLVideoPipeline, save_video, download_models
|
||||
import torch
|
||||
|
||||
|
||||
# Download models
|
||||
# Download models (automatically)
|
||||
# `models/stable_diffusion_xl/sd_xl_base_1.0.safetensors`: [link](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors)
|
||||
# `models/AnimateDiff/mm_sdxl_v10_beta.ckpt`: [link](https://huggingface.co/guoyww/animatediff/resolve/main/mm_sdxl_v10_beta.ckpt)
|
||||
|
||||
download_models(["StableDiffusionXL_v1", "AnimateDiff_xl_beta"])
|
||||
|
||||
model_manager = ModelManager(torch_dtype=torch.float16, device="cuda")
|
||||
model_manager.load_models([
|
||||
@@ -25,4 +25,4 @@ video = pipe(
|
||||
height=1024, width=1024, num_frames=16,
|
||||
num_inference_steps=100,
|
||||
)
|
||||
save_video(video, "video.mp4", fps=16)
|
||||
save_video(video, "output_video.mp4", fps=16)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from diffsynth import save_video, SDXLImagePipeline, ModelManager, SVDVideoPipeline
|
||||
from diffsynth import save_video, SDXLImagePipeline, ModelManager, SVDVideoPipeline, download_models
|
||||
from diffsynth import ModelManager
|
||||
import torch
|
||||
|
||||
|
||||
# Download models
|
||||
# Download models (automatically)
|
||||
# `models/stable_diffusion_xl/sd_xl_base_1.0.safetensors`: [link](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors)
|
||||
# `models/stable_video_diffusion/svd_xt.safetensors`: [link](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt/resolve/main/svd_xt.safetensors)
|
||||
|
||||
download_models(["StableDiffusionXL_v1", "stable-video-diffusion-img2vid-xt"])
|
||||
|
||||
prompt = "cloud, wind"
|
||||
torch.manual_seed(0)
|
||||
@@ -21,8 +21,7 @@ image = pipe(
|
||||
cfg_scale=6,
|
||||
height=1024, width=1024, num_inference_steps=50,
|
||||
)
|
||||
pipe.to("cpu")
|
||||
torch.cuda.empty_cache()
|
||||
model_manager.to("cpu")
|
||||
|
||||
# 2. Image-to-video using SVD
|
||||
model_manager = ModelManager()
|
||||
@@ -34,4 +33,4 @@ video = pipe(
|
||||
motion_bucket_id=127,
|
||||
num_inference_steps=50
|
||||
)
|
||||
save_video(video, "video.mp4", fps=15)
|
||||
save_video(video, "output_video.mp4", fps=15)
|
||||
|
||||
Reference in New Issue
Block a user