Skip to main content

diffusion animation toolkit

Project description

Deforum

Deforum is a Python package for diffusion animation toolkit.

Installation

You can install Deforum using one of the following methods:

PyPI

Install from PyPI using pip:

pip install deforum

Bash script (for Linux)

There's a provided bash script if you're on a Linux system.

./install-linux.sh

Batch file (for Windows)

There's a provided batch file if you're on a Windows system.

install-windows.bat

Requirements

Deforum has two sets of requirements which can be installed using:

pip install -r requirements.txt

For development requirements:

pip install -r requirements-dev.txt

Package Overview

Deforum is structured in following modules:

  • backend: Contains the actual generation models. Options include base for Stable Diffusion 1.5 and sdxl for Stable Diffusion XL.

  • data: Contains helper data for certain types of generation like wildcards, templates, prompts, stopwords, lightweight models.

  • modules: Contains various helper classes and utilities for animation processing, controlnet auxiliary model processors, image transformation etc..

  • pipelines: Contains pipeline classes which are used to generate images or videos using helper modules.

  • typed_classes: Contains typed classes which are used for type validation and help.

  • utils: Contains utilities for handling images, videos, and text outside of actual generation.

Usage

Here's a basic example:

import torch
from deforum import Deforum, DeforumConfig, GenerationArgs

config = DeforumConfig(
    model_name="Lykon/AbsoluteReality",
    model_type="sd1.5",
    dtype=torch.float16,
)

deforum = Deforum(config)

args = GenerationArgs(
    prompt="An ethereal cityscape under a starlit night sky",
    negative_prompt="blurry, bright, devoid, and boring",
    guidance_scale=7.5,
    sampler="euler_ancestral",
    num_inference_steps=30,
)

deforum.generate(args)

License

Deforum is licensed under the MIT License.

For more information please refer to license.

Notes

deforum/backend:

Actual model to be used for generation. Can be one of the following:

  • base: Stable Diffusion 1.5
  • sdxl: Stable Diffusion XL

deforum/backend/mixins:

Superclasses which are used when instantiating classes from backend

deforum/backend/attn_processors:

Diffusers Attention processors

  • flash-attn-2

deforum/backend/model_loading:

Model loading factories for specific model types

  • sd1.5 (sd_loader.py)
  • sdxl (sdxl_loader.py)

deforum/backend/models:

Model classes for specific model types, which implement the actual __call__ function which performs the diffusion inference loop.

  • sd1.5 (sd_pipeline.py)
  • sdxl (sdxl_pipeline.py)
  • abstract (abstract_pipeline.py) # abstract base class for all models

deforum/data:

Helper data for certain types of generation or misc things

  • wildcards
  • templates
  • prompts
  • light-weight-models
  • stopwords

deforum/modules:

Animation helper classes, controlnet auxiliary model processors for use DURING a generation...

  • animation
  • controlnet
  • stylegan2
  • loras
  • noise augmentations
  • upscalers
  • keyframing
  • misc image transformations
  • warp functions
  • video compilation
  • video postprocessing
  • video processing
  • video transformations
  • video utils

deforum/pipelines:

Pipeline classes which are used to generate images or videos sample function implementation for the different models in backend, using helper modules from /modules

  • base (txt2img, img2img, two-pass)
  • vid2vid
  • txt2vid
  • prompt interpolation
  • animatediff
  • ...experimental pipelines

deforum/typed_classes:

Typed classes which are used for type validation and type help

  • deforum initialization config
  • pipeline specific arguments
  • pipeline specific output classes

deforum/utils:

Utilities for working with images / videos / text outside of actual generation

  • image handler
  • template parser
  • image filename processing
  • reading / writing video files
  • mixed model initialization
deforum/
    backend/
        mixins/
    data/
    modules/
    pipelines/
    typed_classes/
    utils/
    deforum.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deforum-0.1.7.tar.gz (66.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deforum-0.1.7-py3-none-any.whl (85.5 kB view details)

Uploaded Python 3

File details

Details for the file deforum-0.1.7.tar.gz.

File metadata

  • Download URL: deforum-0.1.7.tar.gz
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for deforum-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bcbc244958fd803ea80ce7b26d0e2d4f07307b2e265ae5d80a3c3da85a1a16c0
MD5 35a69b517eeac838e5d1e6149c15d325
BLAKE2b-256 3810751c353a37eeacf446cffb1c3a030be966527506dcf39694d58b6651b4ee

See more details on using hashes here.

File details

Details for the file deforum-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: deforum-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 85.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for deforum-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0a1380db9e5947d9d31376514eff6c7af6f5d4b044e618971f2c6784a1a916ba
MD5 ee7e6cf439c9dc6fa20aedb8be8cc00e
BLAKE2b-256 f2d616ad5859e8b31f06059f50b269eec7fe4c1358a42c833dde4945edf98903

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page