---
title: animatediff-motion-lora-zoom-out
canonical_url: "https://www.modelscope.cn/models/Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out"
md_url: "https://www.modelscope.cn/models/Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out.md"
repository: Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out
last_updated: 2023-11-27
pipeline_tag: text-to-video-synthesis
tasks:
  - text-to-video-synthesis
parameters: 19.3M
tensor_type:
  - F32
library_name:
  - pytorch
  - safetensors
  - diffusers
frameworks:
  - pytorch
downloads: 339
stars: 1
tags:
  - animatediff
---

# animatediff-motion-lora-zoom-out

> animatediff-motion-lora-zoom-out - Shanghai_AI_Laboratory 在 ModelScope 开源的模型。Motion LoRAs allow adding specific types of motion to your animations.

- **Repository**: Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out
- **Tasks**: text-to-video-synthesis
- **Parameters**: 19.3M
- **Tags**: animatediff
- **Downloads**: 339
- **Stars**: 1
- **Last updated**: 2023-11-27

Source: https://www.modelscope.cn/models/Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out

---

# Motion LoRAs

Motion LoRAs allow adding specific types of motion to your animations. 

![animatediff-zoom-out-lora.gif](https://cdn-uploads.huggingface.co/production/uploads/6126e46848005fa9ca5c578c/13B2HSVUuZ1t9UseffdHp.gif)



Currently the following types of motion are available for models using the `guoyww/animatediff-motion-adapter-v1-5-2` checkpoint.

- Zoom In/Out
- Pan Left/Right
- Tilt Up/Down
- Rolling Clockwise/Anticlockwise

Please refer to the [AnimateDiff documentation](https://huggingface.co/docs/diffusers/main/en/api/pipelines/animatediff) for information on how to use these Motion LoRAs.

Install requirements first:
```shell
pip install diffusers peft transformers -U
```

# Example code
```python
import torch
from diffusers import MotionAdapter, AnimateDiffPipeline, DDIMScheduler
from diffusers.utils import export_to_gif
from modelscope import snapshot_download

model_dir = snapshot_download("Shanghai_AI_Laboratory/animatediff-motion-adapter-v1-5-2")
# Load the motion adapter
adapter = MotionAdapter.from_pretrained(model_dir)
# load SD 1.5 based finetuned model
model_id = snapshot_download("wyj123456/Realistic_Vision_V5.1_noVAE")
pipe = AnimateDiffPipeline.from_pretrained(model_id, motion_adapter=adapter)
lora_dir = snapshot_download("Shanghai_AI_Laboratory/animatediff-motion-lora-zoom-out")
pipe.load_lora_weights(lora_dir, adapter_name="zoom-out")
pipe.set_adapters(["zoom-out"], adapter_weights=[1.0])
scheduler = DDIMScheduler.from_pretrained(
    model_id, subfolder="scheduler", clip_sample=False, timestep_spacing="linspace", steps_offset=1
)
pipe.scheduler = scheduler

# enable memory savings
pipe.enable_vae_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
    prompt=(
        "masterpiece, bestquality, highlydetailed, ultradetailed, sunset, "
        "orange sky, warm lighting, fishing boats, ocean waves seagulls, "
        "rippling water, wharf, silhouette, serene atmosphere, dusk, evening glow, "
        "golden hour, coastal landscape, seaside scenery"
    ),
    negative_prompt="bad quality, worse quality",
    num_frames=16,
    guidance_scale=7.5,
    num_inference_steps=25,
    generator=torch.Generator("cpu").manual_seed(42),
)
frames = output.frames[0]
export_to_gif(frames, "animation.gif")
```
