# aigc-apps/easyanimate architecture

> Architecture diagram of the GitHub repository aigc-apps/easyanimate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aigc-apps/easyanimate
- Repository: https://github.com/aigc-apps/easyanimate

## Overview

EasyAnimate is a high-resolution, long-video generation and model-training system. Its primary workflow accepts prompts and optional image, video, or control inputs through the UI/API or ComfyUI, runs a generation pipeline, and returns generated video. Separate branches cover dataset preparation and captioning, DiT/LoRA and VAE training, control/inpainting, and reward-based optimization. The README documents these capabilities; some branches are represented at their directory or entry-script level because their implementation was not sampled.

Main entry points: [`easyanimate/pipeline/pipeline_easyanimate.py`](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate.py) (Generation pipeline), [`easyanimate/ui/ui.py`](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/ui/ui.py) (Gradio UI), [`easyanimate/models/transformer3d.py`](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/transformer3d.py) (Video transformer), [`comfyui/comfyui_nodes.py`](https://github.com/aigc-apps/easyanimate/blob/main/comfyui/comfyui_nodes.py) (ComfyUI nodes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_app["App launcher<br/>[app.py]"]
  node_ui["Gradio UI<br/>[ui.py]"]
  node_api["Inference API<br/>[api.py]"]
  node_comfy["ComfyUI nodes<br/>[comfyui_nodes.py]"]
end

subgraph group_generation["Video generation"]
  node_pipeline["Generation pipeline"]
  node_control["Control pipeline"]
  node_inpaint["Inpaint pipeline"]
  node_transformer["Video transformer<br/>[transformer3d.py]"]
  node_attention["Attention blocks<br/>[attention.py]"]
  node_vae["Video autoencoder"]
  node_vae_arch["Causal 3D encoder<br/>[omnigen_enc_dec.py]"]
  node_diffusion["Diffusion utilities"]
end

subgraph group_learning["Training and data"]
  node_datasets["Video datasets"]
  node_sampler["Bucket sampling<br/>[bucket_sampler.py]"]
  node_train["DiT training<br/>[train.py]"]
  node_vae_train["VAE training<br/>[train_vae.py]"]
  node_caption["Caption preprocessing"]
  node_lora["LoRA utilities<br/>[lora_utils.py]"]
end

subgraph group_quality["Evaluation and reward"]
  node_reward["Reward scoring<br/>[reward_fn.py]"]
end

node_user(("User"))
node_video["Generated video"]

node_user -->|"submits request"| node_ui
node_app -->|"launches"| node_ui
node_app -->|"registers routes"| node_api
node_user -->|"configures workflow"| node_comfy
node_ui -->|"runs inference"| node_pipeline
node_ui -->|"runs controls"| node_control
node_ui -->|"runs inpainting"| node_inpaint
node_api -.->|"runs inference"| node_pipeline
node_comfy -->|"runs generation"| node_pipeline
node_comfy -->|"runs controls"| node_control
node_comfy -->|"runs inpainting"| node_inpaint
node_pipeline -->|"denoises latents"| node_transformer
node_pipeline -.->|"decodes latents"| node_vae
node_control -->|"denoises controls"| node_transformer
node_inpaint -->|"denoises masked input"| node_transformer
node_transformer -->|"uses blocks"| node_attention
node_vae -->|"uses encoder"| node_vae_arch
node_pipeline -.->|"uses sampling utilities"| node_diffusion
node_pipeline -.->|"returns video"| node_video
node_datasets -.->|"batches by bucket"| node_sampler
node_datasets -.->|"supplies training data"| node_train
node_sampler -.->|"provides batches"| node_train
node_train -.->|"trains model"| node_transformer
node_vae_train -.->|"trains autoencoder"| node_vae
node_caption -.->|"prepares metadata"| node_datasets
node_train -.->|"supports LoRA training"| node_lora
node_reward -.->|"scores optimization"| node_lora

click node_app "https://github.com/aigc-apps/easyanimate/blob/main/app.py"
click node_ui "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/ui/ui.py"
click node_api "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/api/api.py"
click node_comfy "https://github.com/aigc-apps/easyanimate/blob/main/comfyui/comfyui_nodes.py"
click node_pipeline "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate.py"
click node_control "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate_control.py"
click node_inpaint "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate_inpaint.py"
click node_transformer "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/transformer3d.py"
click node_attention "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/attention.py"
click node_vae "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/autoencoder_magvit.py"
click node_vae_arch "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/vae/ldm/models/omnigen_enc_dec.py"
click node_diffusion "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/utils/gaussian_diffusion.py"
click node_datasets "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/data/dataset_image_video.py"
click node_sampler "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/data/bucket_sampler.py"
click node_train "https://github.com/aigc-apps/easyanimate/blob/main/scripts/train.py"
click node_vae_train "https://github.com/aigc-apps/easyanimate/blob/main/scripts/train_vae.py"
click node_caption "https://github.com/aigc-apps/easyanimate/tree/main/easyanimate/video_caption"
click node_lora "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/utils/lora_utils.py"
click node_reward "https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/reward/reward_fn.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_ui,node_api,node_comfy,node_user toneBlue
class node_pipeline,node_control,node_inpaint,node_transformer,node_attention,node_vae,node_vae_arch,node_diffusion toneAmber
class node_datasets,node_sampler,node_train,node_vae_train,node_caption,node_lora toneMint
class node_reward toneRose
class node_video toneIndigo
```

## Components

### User interfaces

- [App launcher](https://github.com/aigc-apps/easyanimate/blob/main/app.py): `app.py`
- [Gradio UI](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/ui/ui.py): `easyanimate/ui/ui.py`
- [Inference API](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/api/api.py): `easyanimate/api/api.py`
- [ComfyUI nodes](https://github.com/aigc-apps/easyanimate/blob/main/comfyui/comfyui_nodes.py): `comfyui/comfyui_nodes.py`

### Video generation

- [Generation pipeline](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate.py): `easyanimate/pipeline/pipeline_easyanimate.py`
- [Control pipeline](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate_control.py): `easyanimate/pipeline/pipeline_easyanimate_control.py`
- [Inpaint pipeline](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/pipeline/pipeline_easyanimate_inpaint.py): `easyanimate/pipeline/pipeline_easyanimate_inpaint.py`
- [Video transformer](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/transformer3d.py): `easyanimate/models/transformer3d.py`
- [Attention blocks](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/attention.py): `easyanimate/models/attention.py`
- [Video autoencoder](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/models/autoencoder_magvit.py): `easyanimate/models/autoencoder_magvit.py`
- [Causal 3D encoder](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/vae/ldm/models/omnigen_enc_dec.py): `easyanimate/vae/ldm/models/omnigen_enc_dec.py`
- [Diffusion utilities](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/utils/gaussian_diffusion.py): `easyanimate/utils/gaussian_diffusion.py`

### Training and data

- [Video datasets](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/data/dataset_image_video.py): `easyanimate/data/dataset_image_video.py`
- [Bucket sampling](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/data/bucket_sampler.py): `easyanimate/data/bucket_sampler.py`
- [DiT training](https://github.com/aigc-apps/easyanimate/blob/main/scripts/train.py): `scripts/train.py`
- [VAE training](https://github.com/aigc-apps/easyanimate/blob/main/scripts/train_vae.py): `scripts/train_vae.py`
- [Caption preprocessing](https://github.com/aigc-apps/easyanimate/tree/main/easyanimate/video_caption): `easyanimate/video_caption`
- [LoRA utilities](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/utils/lora_utils.py): `easyanimate/utils/lora_utils.py`

### Evaluation and reward

- [Reward scoring](https://github.com/aigc-apps/easyanimate/blob/main/easyanimate/reward/reward_fn.py): `easyanimate/reward/reward_fn.py`

### Other components

- **User**
- **Generated video**

## Connections

- User → Gradio UI: submits request
- App launcher → Gradio UI: launches (evidence: `app.py`)
- App launcher → Inference API: registers routes (evidence: `app.py`)
- User → ComfyUI nodes: configures workflow
- Gradio UI → Generation pipeline: runs inference (evidence: `easyanimate/ui/ui.py`)
- Gradio UI → Control pipeline: runs controls (evidence: `easyanimate/ui/ui.py`)
- Gradio UI → Inpaint pipeline: runs inpainting (evidence: `easyanimate/ui/ui.py`)
- Inference API → Generation pipeline: runs inference
- ComfyUI nodes → Generation pipeline: runs generation (evidence: `comfyui/comfyui_nodes.py`)
- ComfyUI nodes → Control pipeline: runs controls (evidence: `comfyui/comfyui_nodes.py`)
- ComfyUI nodes → Inpaint pipeline: runs inpainting (evidence: `comfyui/comfyui_nodes.py`)
- Generation pipeline → Video transformer: denoises latents (evidence: `easyanimate/pipeline/pipeline_easyanimate.py`)
- Generation pipeline → Video autoencoder: decodes latents
- Control pipeline → Video transformer: denoises controls (evidence: `easyanimate/pipeline/pipeline_easyanimate_control.py`)
- Inpaint pipeline → Video transformer: denoises masked input (evidence: `easyanimate/pipeline/pipeline_easyanimate_inpaint.py`)
- Video transformer → Attention blocks: uses blocks (evidence: `easyanimate/models/transformer3d.py`)
- Video autoencoder → Causal 3D encoder: uses encoder (evidence: `easyanimate/models/autoencoder_magvit.py`)
- Generation pipeline → Diffusion utilities: uses sampling utilities
- Generation pipeline → Generated video: returns video
- Video datasets → Bucket sampling: batches by bucket
- Video datasets → DiT training: supplies training data
- Bucket sampling → DiT training: provides batches
- DiT training → Video transformer: trains model
- VAE training → Video autoencoder: trains autoencoder
- Caption preprocessing → Video datasets: prepares metadata
- DiT training → LoRA utilities: supports LoRA training
- Reward scoring → LoRA utilities: scores optimization
