AnimateLCM / README.md
chaowenguo's picture
Update README.md
82253a6 verified
metadata
pipeline_tag: text-to-video

Using AnimateLCM with Diffusers

import torch, torch_xla, diffusers

motion_adapter = diffusers.MotionAdapter.from_pretrained('chaowenguo/AnimateLCM', torch_dtype=torch.bfloat16, variant='fp16', use_safetensors=True)
vae = diffusers.AutoencoderKL.from_single_file('https://huggingface.co/chaowenguo/pal/blob/main/vae-ft-mse-840000-ema-pruned.safetensors', torch_dtype=torch.bfloat16, use_safetensors=True)
pipe = diffusers.AnimateDiffPipeline.from_single_file('https://huggingface.co/chaowenguo/pal/blob/main/chilloutMix-Ni.safetensors', config='chaowenguo/stable-diffusion-v1-5', safety_checker=None, use_safetensors=True, torch_dtype=torch.bfloat16, motion_adapter=motion_adapter, vae=vae).to(torch_xla.core.xla_model.xla_device())
pipe.scheduler = diffusers.LCMScheduler.from_config(pipe.scheduler.config, beta_schedule='linear')
pipe.load_lora_weights('chaowenguo/AnimateLCM', weight_name='AnimateLCM_sd15_t2v_lora.safetensors')

pipe.enable_vae_slicing()

output = pipe(prompt="A full body gorgeous smiling slim young cleavage robust boob japanese girl, wearing white deep V bandeau pantie, lying on back on white bed, befautiful face, hands with five fingers, best quality, extremely detailed, HD, ultra-realistic, 8K, HQ, masterpiece, trending on artstation, art, smooth", negative_prompt="nipple, dudou, shirt, shawl, hat, sock, sleeve, monochrome, dark background, longbody, lowres, bad anatomy, bad hands, fused fingers, missing fingers, too many fingers, extra digit, fewer difits, cropped, worst quality, low quality, deformed body, bloated, ugly, unrealistic, extra hands and arms", height=912, num_frames=16, guidance_scale=3, num_inference_steps=8, generator=torch.manual_seed(0), context_frames=8)
diffuser.utils.export_to_video(output.frames[0], "animatelcm.mp4")