Skip to content
Projects

About

[CVPR'25] Tora: Trajectory-oriented Diffusion Transformer for Video Generation

Design & Media

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
+3

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

[๐Ÿ”ฅCVPR'25]Tora: Trajectory-oriented Diffusion Transformer for Video Generation

Zhenghao Zhang*, Junchao Liao*, Menghao Li, Zuozhuo Dai, Bingxue Qiu, Siyu Zhu, Long Qin, Weizhi Wang

* equal contribution



This is the official repository for paper "Tora: Trajectory-oriented Diffusion Transformer for Video Generation".

๐Ÿ’ก Abstract

Recent advancements in Diffusion Transformer (DiT) have demonstrated remarkable proficiency in producing high-quality video content. Nonetheless, the potential of transformer-based diffusion models for effectively generating videos with controllable motion remains an area of limited exploration. This paper introduces Tora, the first trajectory-oriented DiT framework that integrates textual, visual, and trajectory conditions concurrently for video generation. Specifically, Tora consists of a Trajectory Extractor (TE), a Spatial-Temporal DiT, and a Motion-guidance Fuser (MGF). The TE encodes arbitrary trajectories into hierarchical spacetime motion patches with a 3D video compression network. The MGF integrates the motion patches into the DiT blocks to generate consistent videos following trajectories. Our design aligns seamlessly with DiTโ€™s scalability, allowing precise control of video contentโ€™s dynamics with diverse durations, aspect ratios, and resolutions. Extensive experiments demonstrate Toraโ€™s excellence in achieving high motion fidelity, while also meticulously simulating the movement of physical world.

๐Ÿ“ฃ Updates

  • 2026/07/27 ๐Ÿ”ฅ๐Ÿ”ฅ Our latest work, Tora3, has been accepted by ACM MM26. Project page: https://ali-videoai.github.io/tora3_page/
  • 2026/04/10 Our latest work, Tora3, is released on arXiv. Tora3 is a trajectory-guided audio-video generation framework that uses object trajectories to jointly guide visual motion and sound, improving physical coherence, motion-sound synchronization, and overall generation quality.
  • 2025/07/08 ๐Ÿ”ฅ๐Ÿ”ฅ Our latest work, Tora2, has been accepted by ACM MM25. Tora2 builds on Tora with design improvements, enabling enhanced appearance and motion customization for multiple entities.
  • 2025/05/24 We open-sourced a LoRA-finetuned model of Wan. It turns things in the image into fluffy toys. Check this out: https://github.com/alibaba/wan-toy-transform
  • 2025/01/06 ๐Ÿ”ฅ๐Ÿ”ฅWe released Tora Image-to-Video, including inference code and model weights.
  • 2024/12/13 SageAttention2 and model compilation are supported in diffusers version. Tested on the A10, these approaches speed up every inference step by approximately 52%, except for the first step.
  • 2024/12/09 ๐Ÿ”ฅ๐Ÿ”ฅDiffusers version of Tora and the corresponding model weights are released. Inference VRAM requirements are reduced to around 5 GiB. Please refer to this for details.
  • 2024/11/25 ๐Ÿ”ฅText-to-Video training code released.
  • 2024/10/31 Model weights uploaded to HuggingFace. We also provided an English demo on ModelScope.
  • 2024/10/23 ๐Ÿ”ฅ๐Ÿ”ฅOur ModelScope Demo is launched. Welcome to try it out! We also upload the model weights to ModelScope.
  • 2024/10/21 Thanks to @kijai for supporting Tora in ComfyUI! Link
  • 2024/10/15 ๐Ÿ”ฅ๐Ÿ”ฅWe released our inference code and model weights. Please note that this is a CogVideoX version of Tora, built on the CogVideoX-5B model. This version of Tora is meant for academic research purposes only. Due to our commercial plans, we will not be open-sourcing the complete version of Tora at this time.
  • 2024/08/27 We released our v2 paper including appendix.
  • 2024/07/31 We submitted our paper on arXiv and released our project page.

๐Ÿ“‘ Table of Contents

๐ŸŽž๏ธ Showcases

https://github.com/user-attachments/assets/949d5e99-18c9-49d6-b669-9003ccd44bf1

https://github.com/user-attachments/assets/7e7dbe87-a8ba-4710-afd0-9ef528ec329b

https://github.com/user-attachments/assets/4026c23d-229d-45d7-b5be-6f3eb9e4fd50

All videos are available in this Link

โœ… TODO List

  • Release our inference code and model weights
  • Provide a ModelScope Demo
  • Release our training code
  • Release diffusers version and optimize the GPU memory usage
  • Release complete version of Tora

๐Ÿงจ Diffusers verision

Please refer to the diffusers version for details.

๐Ÿ Installation

Please make sure your Python version is between 3.10 and 3.12, inclusive of both 3.10 and 3.12.

# Clone this repository.
git clone https://github.com/alibaba/Tora.git
cd Tora

# Install Pytorch (we use Pytorch 2.4.0) and torchvision following the official instructions: https://pytorch.org/get-started/previous-versions/. For example:
conda create -n tora python==3.10
conda activate tora
conda install pytorch==2.4.0 torchvision==0.19.0 pytorch-cuda=12.1 -c pytorch -c nvidia

# Install requirements
cd modules/SwissArmyTransformer
pip install -e .
cd ../../sat
pip install -r requirements.txt
cd ..

๐Ÿ“ฆ Model Weights

Folder Structure

Tora
โ””โ”€โ”€ sat
    โ””โ”€โ”€ ckpts
        โ”œโ”€โ”€ t5-v1_1-xxl
        โ”‚   โ”œโ”€โ”€ model-00001-of-00002.safetensors
        โ”‚   โ””โ”€โ”€ ...
        โ”œโ”€โ”€ vae
        โ”‚   โ””โ”€โ”€ 3d-vae.pt
        โ”œโ”€โ”€ tora
        โ”‚   โ”œโ”€โ”€ i2v
        โ”‚   โ”‚   โ””โ”€โ”€ mp_rank_00_model_states.pt
        โ”‚   โ””โ”€โ”€ t2v
        โ”‚       โ””โ”€โ”€ mp_rank_00_model_states.pt
        โ””โ”€โ”€ CogVideoX-5b-sat # for training stage 1
            โ””โ”€โ”€ mp_rank_00_model_states.pt

Download Links

Note: Downloading the tora weights requires following the CogVideoX License. You can choose one of the following options: HuggingFace, ModelScope, or native links. After downloading the model weights, you can put them in the Tora/sat/ckpts folder.

HuggingFace

# This can be faster
pip install "huggingface_hub[hf_transfer]"
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download Alibaba-Research-Intelligence-Computing/Tora --local-dir ckpts

or

# use git
git lfs install
git clone https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora

ModelScope

  • SDK
from modelscope import snapshot_download
model_dir = snapshot_download('xiaoche/Tora')
  • Git
git clone https://www.modelscope.cn/xiaoche/Tora.git

Native

๐Ÿ”„ Inference

Text to Video

It requires around 30 GiB GPU memory tested on NVIDIA A100.

cd sat
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True torchrun --standalone --nproc_per_node=$N_GPU sample_video.py --base configs/tora/model/cogvideox_5b_tora.yaml configs/tora/inference_sparse.yaml --load ckpts/tora/t2v --output-dir samples --point_path trajs/coaster.txt --input-file assets/text/t2v/examples.txt

You can change the --input-file and --point_path to your own prompts and trajectory points files. Please note that the trajectory is drawn on a 256x256 canvas.

Replace $N_GPU with the number of GPUs you want to use.

Image to Video

cd sat
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True torchrun --standalone --nproc_per_node=$N_GPU sample_video.py --base configs/tora/model/cogvideox_5b_tora_i2v.yaml configs/tora/inference_sparse.yaml --load ckpts/tora/i2v --output-dir samples --point_path trajs/sawtooth.txt --input-file assets/text/i2v/examples.txt --img_dir assets/images --image2video

The first frame images should be placed in the --img_dir. The names of these images should be specified in the corresponding text prompt in --input-file, seperated by @@.

Recommendations for Text Prompts

For text prompts, we highly recommend using GPT-4 to enhance the details. Simple prompts may negatively impact both visual quality and motion control effectiveness.

You can refer to the following resources for guidance:

๐Ÿ–ฅ๏ธ Gradio Demo

Usage:

cd sat
python app.py --load ckpts/tora/t2v

๐Ÿง  Training

Data Preparation

Following this guide https://github.com/THUDM/CogVideo/blob/main/sat/README.md#preparing-the-dataset, structure the datasets as follows:

.
โ”œโ”€โ”€ labels
โ”‚   โ”œโ”€โ”€ 1.txt
โ”‚   โ”œโ”€โ”€ 2.txt
โ”‚   โ”œโ”€โ”€ ...
โ””โ”€โ”€ videos
    โ”œโ”€โ”€ 1.mp4
    โ”œโ”€โ”€ 2.mp4
    โ”œโ”€โ”€ ...

Training data examples are in sat/training_examples

Text to Video

It requires around 60 GiB GPU memory tested on NVIDIA A100.

Replace $N_GPU with the number of GPUs you want to use.

  • Stage 1
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True torchrun --standalone --nproc_per_node=$N_GPU train_video.py --base configs/tora/model/cogvideox_5b_tora.yaml configs/tora/train_dense.yaml --experiment-name "t2v-stage1"
  • Stage 2
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True torchrun --standalone --nproc_per_node=$N_GPU train_video.py --base configs/tora/model/cogvideox_5b_tora.yaml configs/tora/train_sparse.yaml --experiment-name "t2v-stage2"

๐ŸŽฏ Troubleshooting

1. ValueError: Non-consecutive added token...

Upgrade the transformers package to 4.44.2. See this issue.

๐Ÿค Acknowledgements

We would like to express our gratitude to the following open-source projects that have been instrumental in the development of our project:

  • CogVideo: An open source video generation framework by THUKEG.
  • Open-Sora: An open source video generation framework by HPC-AI Tech.
  • MotionCtrl: A video generation model supporting motion control by ARC Lab, Tencent PCG.
  • ComfyUI-DragNUWA: An implementation of DragNUWA for ComfyUI.

Special thanks to the contributors of these libraries for their hard work and dedication!

๐Ÿ“„ Our previous work

๐Ÿ“š Citation

@inproceedings{zhang2025tora,
  title={Tora: Trajectory-oriented diffusion transformer for video generation},
  author={Zhang, Zhenghao and Liao, Junchao and Li, Menghao and Dai, Zuozhuo and Qiu, Bingxue and Zhu, Siyu and Qin, Long and Wang, Weizhi},
  booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
  pages={2063--2073},
  year={2025}
}

Explore related projects

Loadingโ€ฆ