0

Text to Video generation with Wan2.1 and OpenVINO

Wan2.1 is a comprehensive and open suite of video foundation models that pushes the boundaries of video generation.

Example · مثال

Content

Text to Video generation with Wan2.1 and OpenVINO

Wan2.1 is a comprehensive and open suite of video foundation models that pushes the boundaries of video generation.

Built upon the mainstream diffusion transformer paradigm, Wan 2.1 achieves significant advancements in generative capabilities through a series of innovations, including our novel spatio-temporal variational autoencoder (VAE), scalable pre-training strategies, large-scale data construction, and automated evaluation metrics. These contributions collectively enhance the model's performance and versatility.

You can find more details about model in model card and original repository

In this tutorial we consider how to convert, optimize and run Wan2.1 model using OpenVINO. Additionally, for achieving inference speedup, we will apply CausVid distillation approach using LoRA.

Current video diffusion models achieve impressive generation quality but struggle in interactive applications due to bidirectional attention dependencies. The generation of a single frame requires the model to process the entire sequence, including the future. CausVid address this limitation by adapting a pretrained bidirectional diffusion transformer to an autoregressive transformer that generates frames on-the-fly. To further reduce latency, the authors extend distribution matching distillation (DMD) to videos, distilling 50-step diffusion model into a 4-step generator.

The method distills a many-step, bidirectional video diffusion model into a 4-step, causal generator. The training process consists of two stages:

  1. Student Initialization: Initialization of the causal student by pretraining it on a small set of ODE solution pairs generated by the bidirectional teacher. This step helps stabilize the subsequent distillation training.
  2. Asymmetric Distillation: Using the bidirectional teacher model, we train the causal student generator through a distribution matching distillation loss.

More details about CausVid can be found in the paper, original repository and project page

Notebook contents

This tutorial consists of the following steps:

  • Prerequisites
  • Convert and Optimize model
  • Run inference pipeline
  • Interactive inference

in this demonstration you will learn how to build text-to-video generation pipeline using Wan2.1 and OpenVINO.

Example of model input prompt and inference result are represented below:

| | | |-------|-------------------------------------| |prompt:| A cat walks on the grass, realistic | |generated: | |

Installation instructions

This is a self-contained example that relies solely on its own code.</br> We recommend running the notebook in a virtual environment. You only need a Jupyter server to start. For details, please refer to [Installation Guide](../../README.md).

Source and license

Source
Intel OpenVINO Notebooks
Original
openvinotoolkit/openvino_notebooks/notebooks/wan2.1-text-to-video
License
Apache-2.0