結果
動画はGoogle Bloggerに載せています。
support-touchsp.blogspot.com
最大32フレームまで作れるようです。
Pythonスクリプト
import torch from diffusers import MotionAdapter, AnimateDiffPipeline, LCMScheduler from diffusers.utils import export_to_gif # from https://huggingface.co/wangfuyun/AnimateLCM adapter = MotionAdapter.from_pretrained("AnimateLCM") model_id = "model/rcnzCartoon3d_v20" pipe = AnimateDiffPipeline.from_pretrained( model_id, motion_adapter=adapter, torch_dtype=torch.float16 ).to("cuda") pipe.scheduler = LCMScheduler.from_pretrained( model_id, subfolder="scheduler", beta_schedule="linear", clip_sample=False, timestep_spacing="linspace", steps_offset=1 ) pipe.load_lora_weights("AnimateLCM", weight_name="sd15_lora_beta.safetensors", adapter_name="lcm-lora") pipe.set_adapters(["lcm-lora"], [0.8]) pipe.enable_free_init( method="gaussian", num_iters=3, use_fast_sampling=True ) generator = torch.manual_seed(2024) output = pipe( prompt="A cute raccoon playing the guitar in a boat on the ocean", negative_prompt="bad quality, worse quality", num_frames=32, guidance_scale=2.0, num_inference_steps=6, generator=generator ).frames[0] export_to_gif(output, "animation.gif")