Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ conda env create -f environment.yaml
conda activate animatediff
```

if using --format mp4

`pip install "imageio[ffmpeg]"`

### Download Base T2I & Motion Module Checkpoints
We provide two versions of our Motion Module, which are trained on stable-diffusion-v1-4 and finetuned on v1-5 seperately.
It's recommanded to try both of them for best results.
Expand Down
8 changes: 5 additions & 3 deletions scripts/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def main(args):

time_str = datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S")
savedir = f"samples/{Path(args.config).stem}-{time_str}"
extension = args.format
os.makedirs(savedir)
inference_config = OmegaConf.load(args.inference_config)

Expand Down Expand Up @@ -134,13 +135,13 @@ def main(args):
samples.append(sample)

prompt = "-".join((prompt.replace("/", "").split(" ")[:10]))
save_videos_grid(sample, f"{savedir}/sample/{sample_idx}-{prompt}.gif")
print(f"save to {savedir}/sample/{prompt}.gif")
save_videos_grid(sample, f"{savedir}/sample/{sample_idx}-{prompt}.{extension}")
print(f"save to {savedir}/sample/{prompt}.{extension}")

sample_idx += 1

samples = torch.concat(samples)
save_videos_grid(samples, f"{savedir}/sample.gif", n_rows=4)
save_videos_grid(samples, f"{savedir}/sample.{extension}", n_rows=4)

OmegaConf.save(config, f"{savedir}/config.yaml")

Expand All @@ -150,6 +151,7 @@ def main(args):
parser.add_argument("--pretrained_model_path", type=str, default="models/StableDiffusion/stable-diffusion-v1-5",)
parser.add_argument("--inference_config", type=str, default="configs/inference/inference.yaml")
parser.add_argument("--config", type=str, required=True)
parser.add_argument("--format", type=str, default="gif")

parser.add_argument("--L", type=int, default=16 )
parser.add_argument("--W", type=int, default=512)
Expand Down