Run this model with HF Jobs
Run Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update model card for Tora2
#1
by nielsr HF Staff - opened
1234567891011121314151617181920212223242526272829305 unmodified lines3637383940414243444546474849505 unmodified lines5657585960614 unmodified lines66676869707112 unmodified lines84858687888990919293949596---license: otherlanguage:- enbase_model:- THUDM/CogVideoX-5bpipeline_tag: text-to-videolibrary_name: diffuserstags:- video- video-generation- cogvideox- alibaba---<div align="center"><img src="icon.jpg" width="250"/><h2><center>Tora: Trajectory-oriented Diffusion Transformer for Video Generation</h2>Zhenghao Zhang\*, Junchao Liao\*, Menghao Li, Zuozhuo Dai, Bingxue Qiu, Siyu Zhu, Long Qin, Weizhi Wang\* equal contribution<br><a href='https://arxiv.org/abs/2407.21705'><img src='https://img.shields.io/badge/ArXiv-2407.21705-red'></a><a href='https://ali-videoai.github.io/tora_video/'><img src='https://img.shields.io/badge/Project-Page-Blue'></a><a href="https://github.com/alibaba/Tora"><img src='https://img.shields.io/badge/Github-Link-orange'></a><a href='https://www.modelscope.cn/studios/xiaoche/Tora'><img src='https://img.shields.io/badge/🤖_ModelScope-ZH_demo-%23654dfc'></a><a href='https://www.modelscope.cn/studios/Alibaba_Research_Intelligence_Computing/Tora_En'><img src='https://img.shields.io/badge/🤖_ModelScope-EN_demo-%23654dfc'></a>5 unmodified lines<a href='https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers'><img src='https://img.shields.io/badge/🤗_HuggingFace-T2V_weights(diffusers)-%23ff9e0e'></a></div>## Please visit our [Github repo](https://github.com/alibaba/Tora) for more details.## 💡 AbstractRecent 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- `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](diffusers-version/README.md) for details.5 unmodified lines- `2024/08/27` We released our v2 paper including appendix.- `2024/07/31` We submitted our paper on arXiv and released our project page.## 🎞️ Showcaseshttps://github.com/user-attachments/assets/949d5e99-18c9-49d6-b669-9003ccd44bf14 unmodified linesAll videos are available in this [Link](https://cloudbook-public-daily.oss-cn-hangzhou.aliyuncs.com/Tora_t2v/showcases.zip)## 🤝 AcknowledgementsWe would like to express our gratitude to the following open-source projects that have been instrumental in the development of our project:12 unmodified lines## 📚 Citation```bibtex@misc{zhang2024toratrajectoryorienteddiffusiontransformer,title={Tora: Trajectory-oriented Diffusion Transformer for Video Generation},author={Zhenghao Zhang and Junchao Liao and Menghao Li and Zuozhuo Dai and Bingxue Qiu and Siyu Zhu and Long Qin and Weizhi Wang},year={2024},eprint={2407.21705},archivePrefix={arXiv},primaryClass={cs.CV},url={https://arxiv.org/abs/2407.21705},}```1234567891011121314151617181920212223242526272829303132333435365 unmodified lines424344454647484950515253545556575 unmodified lines6364656667686970717273747576777879808182834 unmodified lines88899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627712 unmodified lines290291292293294295296297298299300---base_model:- THUDM/CogVideoX-5blanguage:- enlibrary_name: diffuserslicense: otherpipeline_tag: text-to-videotags:- video- video-generation- cogvideox- alibaba- tora2- multi-entity-video-generationpaper: https://huggingface.co/papers/2507.05963url: https://ali-videoai.github.io/Tora2_page/repo_code: https://github.com/alibaba/Tora---<div align="center"><img src="icon.jpg" width="250"/><h2><center>Tora2: Motion and Appearance Customized Diffusion Transformer for Multi-Entity Video Generation</h2>Zhenghao Zhang\*, Junchao Liao\*, Menghao Li, Zuozhuo Dai, Bingxue Qiu, Siyu Zhu, Long Qin, Weizhi Wang\* equal contribution<br><a href='https://huggingface.co/papers/2507.05963'><img src='https://img.shields.io/badge/Paper-2507.05963-red'></a><a href='https://ali-videoai.github.io/Tora2_page/'><img src='https://img.shields.io/badge/Project-Page-Blue'></a><a href="https://github.com/alibaba/Tora"><img src='https://img.shields.io/badge/Github-Link-orange'></a><a href='https://www.modelscope.cn/studios/xiaoche/Tora'><img src='https://img.shields.io/badge/🤖_ModelScope-ZH_demo-%23654dfc'></a><a href='https://www.modelscope.cn/studios/Alibaba_Research_Intelligence_Computing/Tora_En'><img src='https://img.shields.io/badge/🤖_ModelScope-EN_demo-%23654dfc'></a>5 unmodified lines<a href='https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora_T2V_diffusers'><img src='https://img.shields.io/badge/🤗_HuggingFace-T2V_weights(diffusers)-%23ff9e0e'></a></div>This is the official repository for the paper "Tora2: Motion and Appearance Customized Diffusion Transformer for Multi-Entity Video Generation".## 💡 AbstractRecent advances in diffusion transformer models for motion-guided video generation, such as Tora, have shown significant progress. In this paper, we present Tora2, an enhanced version of Tora, which introduces several design improvements to expand its capabilities in both appearance and motion customization. Specifically, we introduce a decoupled personalization extractor that generates comprehensive personalization embeddings for multiple open-set entities, better preserving fine-grained visual details compared to previous methods. Building on this, we design a gated self-attention mechanism to integrate trajectory, textual description, and visual information for each entity. This innovation significantly reduces misalignment in multimodal conditioning during training. Moreover, we introduce a contrastive loss that jointly optimizes trajectory dynamics and entity consistency through explicit mapping between motion and personalization embeddings. Tora2 is, to our best knowledge, the first method to achieve simultaneous multi-entity customization of appearance and motion for video generation. Experimental results demonstrate that Tora2 achieves competitive performance with state-of-the-art customization methods while providing advanced motion control capabilities, which marks a critical advancement in multi-condition video generation.## 📣 Updates- `2025/07/08` 🔥🔥 Our latest work, [Tora2](https://ali-videoai.github.io/Tora2_page/), 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](https://github.com/Wan-Video/Wan2.1). 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](diffusers-version/README.md) for details.5 unmodified lines- `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](#%EF%B8%8F-showcases)- [✅ TODO List](#-todo-list)- [🧨 Diffusers verision](#-diffusers-verision)- [🐍 Installation](#-installation)- [📦 Model Weights](#-model-weights)- [🔄 Inference](#-inference)- [🖥️ Gradio Demo](#%EF%B8%8F-gradio-demo)- [🧠 Training](#-training)- [🎯 Troubleshooting](#-troubleshooting)- [🤝 Acknowledgements](#-acknowledgements)- [📄 Our previous work](#-our-previous-work)- [📚 Citation](#-citation)## 🎞️ Showcaseshttps://github.com/user-attachments/assets/949d5e99-18c9-49d6-b669-9003ccd44bf14 unmodified linesAll videos are available in this [Link](https://cloudbook-public-daily.oss-cn-hangzhou.aliyuncs.com/Tora_t2v/showcases.zip)## ✅ TODO List- [x] Release our inference code and model weights- [x] Provide a ModelScope Demo- [x] Release our training code- [x] Release diffusers version and optimize the GPU memory usage- [x] Release complete version of Tora## 🧨 Diffusers verisionPlease refer to [the diffusers version](diffusers-version/README.md) for details.## 🐍 InstallationPlease make sure your Python version is between 3.10 and 3.12, inclusive of both 3.10 and 3.12.```bash# Clone this repository.git clone https://github.com/alibaba/Tora.gitcd 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.10conda activate toraconda install pytorch==2.4.0 torchvision==0.19.0 pytorch-cuda=12.1 -c pytorch -c nvidia# Install requirementscd modules/SwissArmyTransformerpip install -e .cd ../../satpip install -r requirements.txtcd ..```## 📦 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](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```bash# This can be fasterpip install "huggingface_hub[hf_transfer]"HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download Alibaba-Research-Intelligence-Computing/Tora --local-dir ckpts```or```bash# use gitgit lfs installgit clone https://huggingface.co/Alibaba-Research-Intelligence-Computing/Tora```#### ModelScope- SDK```bashfrom modelscope import snapshot_downloadmodel_dir = snapshot_download('xiaoche/Tora')```- Git```bashgit clone https://www.modelscope.cn/xiaoche/Tora.git```#### Native- Download the VAE and T5 model following [CogVideo](https://github.com/THUDM/CogVideo/blob/main/sat/README.md#2-download-model-weights):- VAE: https://cloud.tsinghua.edu.cn/f/fdba7608a49c463ba754/?dl=1- T5: [text_encoder](https://huggingface.co/THUDM/CogVideoX-2b/tree/main/text_encoder), [tokenizer](https://huggingface.co/THUDM/CogVideoX-2b/tree/main/tokenizer)- Tora t2v model weights: [Link](https://cloudbook-public-daily.oss-cn-hangzhou.aliyuncs.com/Tora_t2v/mp_rank_00_model_states.pt). Downloading this weight requires following the [CogVideoX License](CogVideoX_LICENSE).## 🔄 Inference### Text to VideoIt requires around 30 GiB GPU memory tested on NVIDIA A100.```bashcd satPYTORCH_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```bashcd satPYTORCH_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 PromptsFor 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:- [CogVideoX Documentation](https://github.com/THUDM/CogVideo/blob/main/inference/convert_demo.py)- [OpenSora Scripts](https://github.com/hpcaitech/Open-Sora/blob/main/scripts/inference.py)## 🖥️ Gradio DemoUsage:```bashcd satpython app.py --load ckpts/tora/t2v```## 🧠 Training### Data PreparationFollowing 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 VideoIt requires around 60 GiB GPU memory tested on NVIDIA A100.Replace `$N_GPU` with the number of GPUs you want to use.- Stage 1```bashPYTORCH_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```bashPYTORCH_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](https://github.com/THUDM/CogVideo/issues/213) issue.## 🤝 AcknowledgementsWe would like to express our gratitude to the following open-source projects that have been instrumental in the development of our project:12 unmodified lines## 📚 Citation```bibtex@article{zhang2025tora2,title={Tora2: Motion and Appearance Customized Diffusion Transformer for Multi-Entity 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},journal={arXiv preprint arXiv:2507.05963},year={2025},url={https://huggingface.co/papers/2507.05963},}```
README.md+222-18