๐ Welcome!
English | ็ฎไฝไธญๆ | ๆฅๆฌ่ช
- I. Introduction
- II. Quick Start and Usage
- III. Supported Models
- IV. Video Works
- V. References
- VI. Citation
- VII. Limitations and Risks
- VIII. License
VideoX-Fun is a video generation pipeline that can be used to generate AI images and videos, as well as to train baseline and Lora models for Diffusion Transformer. We support direct prediction from pre-trained baseline models to generate videos with different resolutions, durations, and FPS. Additionally, we also support users in training their own baseline and Lora models to perform specific style transformations.
DSW has free GPU time, which can be applied once by a user and is valid for 3 months after applying.
Aliyun provide free GPU time in Freetier, get it and use in Aliyun PAI-DSW to start CogVideoX-Fun within 5min!
We have verified this repo execution on the following environment:
The detailed of Windows:
- OS: Windows 10
- python: python3.10 & python3.11
- pytorch: torch2.2.0
- CUDA: 11.8 & 12.1
- CUDNN: 8+
- GPU๏ผ Nvidia-3060 12G & Nvidia-3090 24G
The detailed of Linux:
- OS: Ubuntu 20.04, CentOS
- python: python3.10 & python3.11
- pytorch: torch2.2.0
- CUDA: 11.8 & 12.1
- CUDNN: 8+
- GPU๏ผNvidia-V100 16G & Nvidia-A10 24G & Nvidia-A100 40G & Nvidia-A100 80G
We need about 60GB available on disk (for saving weights), please check!
If you are using docker, please make sure that the graphics card driver and CUDA environment have been installed correctly in your machine.
Then execute the following commands in this way:
# pull image
docker pull mybigpai-public-registry.cn-beijing.cr.aliyuncs.com/easycv/torch_cuda:cogvideox_fun
# enter image
docker run -it -p 7860:7860 --network host --gpus all --security-opt seccomp:unconfined --shm-size 200g mybigpai-public-registry.cn-beijing.cr.aliyuncs.com/easycv/torch_cuda:cogvideox_fun
# clone code
git clone https://github.com/aigc-apps/VideoX-Fun.git
# enter VideoX-Fun's dir
cd VideoX-Fun
# download weights
mkdir models/Diffusion_Transformer
mkdir models/Personalized_Model
# Please use the hugginface link or modelscope link to download the model.
# CogVideoX-Fun
# https://huggingface.co/alibaba-pai/CogVideoX-Fun-V1.1-5b-InP
# https://modelscope.cn/models/PAI/CogVideoX-Fun-V1.1-5b-InP
# Wan
# https://huggingface.co/alibaba-pai/Wan2.1-Fun-V1.1-14B-InP
# https://modelscope.cn/models/PAI/Wan2.1-Fun-V1.1-14B-InP
We'd better place the weights along the specified path:
Via ComfyUI:
Put the models into the ComfyUI weights folder ComfyUI/models/Fun_Models/:
๐ฆ ComfyUI/
โโโ ๐ models/
โ โโโ ๐ Fun_Models/
โ โโโ ๐ CogVideoX-Fun-V1.1-2b-InP/
โ โโโ ๐ CogVideoX-Fun-V1.1-5b-InP/
โ โโโ ๐ Wan2.1-Fun-14B-InP
โ โโโ ๐ Wan2.1-Fun-1.3B-InP/
Run its own python file or UI interface:
๐ฆ models/
โโโ ๐ Diffusion_Transformer/
โ โโโ ๐ CogVideoX-Fun-V1.1-2b-InP/
โ โโโ ๐ CogVideoX-Fun-V1.1-5b-InP/
โ โโโ ๐ Wan2.1-Fun-14B-InP
โ โโโ ๐ Wan2.1-Fun-1.3B-InP/
โโโ ๐ Personalized_Model/
โ โโโ your trained trainformer model / your trained lora model (for UI load)
Video and image models share the exact same inference entry, provided by scripts or UI under examples/{model_name}/.
| Entry | Suitable Scenario | Config Granularity |
|---|---|---|
| Python file | Batch generation, parameter debugging | Full parameters |
| WebUI | Interactive experience | Common parameters only |
| ComfyUI | Existing ComfyUI workflow | Node parameters |
Table: inference entry selection
Since Wan2.1 has a very large number of parameters, we need to consider memory optimization strategies to adapt to consumer-grade GPUs. We provide GPU_memory_mode for each prediction file, allowing you to choose between model_cpu_offload, model_cpu_offload_and_qfloat8, and sequential_cpu_offload. This solution is also applicable to CogVideoX-Fun generation.
model_cpu_offload: The entire model is moved to the CPU after use, saving some GPU memory.model_cpu_offload_and_qfloat8: The entire model is moved to the CPU after use, and the transformer model is quantized to float8, saving more GPU memory.sequential_cpu_offload: Each layer of the model is moved to the CPU after use. It is slower but saves a significant amount of GPU memory.
qfloat8 may slightly reduce model performance but saves more GPU memory. If you have sufficient GPU memory, it is recommended to use model_cpu_offload.
- Step 1: Download the corresponding weights and place them in the
modelsfolder. - Step 2: Use different files for prediction based on the weights and prediction goals. This library currently supports CogVideoX-Fun, Wan2.1, and Wan2.1-Fun. Different models are distinguished by folder names under the
examplesfolder, and their supported features vary. Use them accordingly. Below is an example using CogVideoX-Fun:- Text-to-Video:
- Modify
prompt,neg_prompt,guidance_scale, andseedin the fileexamples/cogvideox_fun/predict_t2v.py. - Run the file
examples/cogvideox_fun/predict_t2v.pyand wait for the results. The generated videos will be saved in the foldersamples/cogvideox-fun-videos.
- Modify
- Image-to-Video:
- Modify
validation_image_start,validation_image_end,prompt,neg_prompt,guidance_scale, andseedin the fileexamples/cogvideox_fun/predict_i2v.py. validation_image_startis the starting image of the video, andvalidation_image_endis the ending image of the video.- Run the file
examples/cogvideox_fun/predict_i2v.pyand wait for the results. The generated videos will be saved in the foldersamples/cogvideox-fun-videos_i2v.
- Modify
- Video-to-Video:
- Modify
validation_video,validation_image_end,prompt,neg_prompt,guidance_scale, andseedin the fileexamples/cogvideox_fun/predict_v2v.py. validation_videois the reference video for video-to-video generation. You can use the following demo video: Demo Video.- Run the file
examples/cogvideox_fun/predict_v2v.pyand wait for the results. The generated videos will be saved in the foldersamples/cogvideox-fun-videos_v2v.
- Modify
- Controlled Video Generation (Canny, Pose, Depth, etc.):
- Modify
control_video,validation_image_end,prompt,neg_prompt,guidance_scale, andseedin the fileexamples/cogvideox_fun/predict_v2v_control.py. control_videois the control video extracted using operators such as Canny, Pose, or Depth. You can use the following demo video: Demo Video.- Run the file
examples/cogvideox_fun/predict_v2v_control.pyand wait for the results. The generated videos will be saved in the foldersamples/cogvideox-fun-videos_v2v_control.
- Modify
- Text-to-Video:
- Step 3: If you want to integrate other backbones or Loras trained by yourself, modify
lora_pathand relevant paths inexamples/{model_name}/predict_t2v.pyorexamples/{model_name}/predict_i2v.pyas needed.
When using multi-GPU inference, please make sure to install the xfuser. We recommend installing xfuser==0.4.2 and yunchang==0.6.2.
pip install xfuser==0.4.2 --progress-bar off -i https://mirrors.aliyun.com/pypi/simple/
pip install yunchang==0.6.2 --progress-bar off -i https://mirrors.aliyun.com/pypi/simple/
Please ensure that the product of ulysses_degree and ring_degree equals the number of GPUs being used. For example, if you are using 8 GPUs, you can set ulysses_degree=2 and ring_degree=4, or alternatively ulysses_degree=4 and ring_degree=2.
ulysses_degreeperforms parallelization after splitting across the heads.ring_degreeperforms parallelization after splitting across the sequence.
Compared to ulysses_degree, ring_degree incurs higher communication costs. Therefore, when setting these parameters, you should take into account both the sequence length and the number of heads in the model.
Letโs take 8-GPU parallel inference as an example:
-
For Wan2.1-Fun-V1.1-14B-InP, which has 40 heads,
ulysses_degreeshould be set to a divisor of 40 (e.g., 2, 4, 8, etc.). Thus, when using 8 GPUs for parallel inference, you can setulysses_degree=8andring_degree=1. -
For Wan2.1-Fun-V1.1-1.3B-InP, which has 12 heads,
ulysses_degreeshould be set to a divisor of 12 (e.g., 2, 4, etc.). Thus, when using 8 GPUs for parallel inference, you can setulysses_degree=4andring_degree=2.
After setting the parameters, run the following command for parallel inference:
torchrun --nproc-per-node=8 examples/wan2.1_fun/predict_t2v.pyThe web UI supports text-to-video, image-to-video, video-to-video, and controlled video generation (Canny, Pose, Depth, etc.). This library currently supports CogVideoX-Fun, Wan2.1, and Wan2.1-Fun. Different models are distinguished by folder names under the examples folder, and their supported features vary. Use them accordingly. Below is an example using CogVideoX-Fun:
- Step 1: Download the corresponding weights and place them in the
modelsfolder. - Step 2: Run the file
examples/cogvideox_fun/app.pyto access the Gradio interface. - Step 3: Select the generation model on the page, fill in
prompt,neg_prompt,guidance_scale, andseed, click "Generate," and wait for the results. The generated videos will be saved in thesamplefolder.
For details, refer to ComfyUI README.
A complete model training pipeline consists of data preprocessing and Video DiT training.
Training documents for each model are unified under scripts/{model_name}/. For details, see 3.3 Training Documents per Model.
A complete data preprocessing link for long video segmentation, cleaning, and description can refer to README in the video captions section.
If you want to train a text to image and video generation model. You need to arrange the dataset in this format.
๐ฆ project/
โโโ ๐ datasets/
โ โโโ ๐ internal_datasets/
โ โโโ ๐ train/
โ โ โโโ ๐ 00000001.mp4
โ โ โโโ ๐ 00000002.jpg
โ โ โโโ ๐ .....
โ โโโ ๐ json_of_internal_datasets.json
The json_of_internal_datasets.json is a standard JSON file. The file_path in the json can to be set as relative path, as shown in below:
[
{
"file_path": "train/00000001.mp4",
"text": "A group of young men in suits and sunglasses are walking down a city street.",
"type": "video"
},
{
"file_path": "train/00000002.jpg",
"text": "A group of young men in suits and sunglasses are walking down a city street.",
"type": "image"
},
.....
]You can also set the path as absolute path as follow:
[
{
"file_path": "/mnt/data/videos/00000001.mp4",
"text": "A group of young men in suits and sunglasses are walking down a city street.",
"type": "video"
},
{
"file_path": "/mnt/data/train/00000001.jpg",
"text": "A group of young men in suits and sunglasses are walking down a city street.",
"type": "image"
},
.....
]
The training scripts and launch sh files for each model are located under scripts/{model_name}/. The sh file names vary by task, such as train.sh, train_lora.sh, train_control.sh, train_control_distill.sh, etc.; refer to the actual files in the directory.
If the data format is relative path during data preprocessing, please set scripts/{model_name}/train.sh as follow.
export DATASET_NAME="datasets/internal_datasets/"
export DATASET_META_NAME="datasets/internal_datasets/json_of_internal_datasets.json"
If the data format is absolute path during data preprocessing, please set scripts/{model_name}/train.sh as follow (DATASET_NAME is left empty so the dataset directory prefix is no longer concatenated).
export DATASET_NAME=""
export DATASET_META_NAME="/mnt/data/json_of_internal_datasets.json"
Finally, run the corresponding script.
sh scripts/{model_name}/train.shFor parameter details, training documents for each model are unified under scripts/{model_name}/.
| Model | Baseline Training | LoRA Training | Others |
|---|---|---|---|
| Wan2.1-Fun | EN / ZH | EN / ZH | Control ENใReward LoRA |
| Wan2.2 | EN / ZH | EN / ZH | Distill ENใS2VใAnimate |
| Wan2.2-Fun | EN / ZH | EN / ZH | Control LoRA EN |
| CogVideoX-Fun | EN / ZH | EN / ZH | Control ENใReward LoRA |
| Qwen-Image | EN / ZH | EN / ZH | Edit EN |
| Qwen-Image-2.1 | EN / ZH | - | Control EN / ZH |
| Z-Image | EN / ZH | EN / ZH | GRPO LoRA EN |
For other models, check the READMEs under scripts/{model_name}/.
The table below summarizes currently supported model families and weights. Video and image models share the same inference and training entry. Each row represents one model family; the fourth column is an embedded four-column HTML table (Weight, Hugging Face, ModelScope, Description). ๐ค is Hugging Face, ๐ค is ModelScope (recommended for users in mainland China), and - means the corresponding channel has no public repo or requires authentication. For training docs of each model, see 3.3 Training Documents per Model.
| Model Family | Modality | Supported Tasks | Weight / Download / Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Wan2.2-Fun | Video | Series trained by this project on Wan2.2, covering T2V, I2V, first/last frame, controlled generation, and camera control |
|
||||||||||||||||||||||||||||
| Wan2.2-VACE-Fun | Video | Series trained by this project with the VACE scheme, covering controlled generation and subject reference |
|
||||||||||||||||||||||||||||
| Wan2.2 | Video | Official Wan weights covering T2V, I2V, audio-driven, and character animation; can be used as training baseline for Wan2.2-Fun |
|
||||||||||||||||||||||||||||
| Wan2.1-Fun V1.1 | Video | V1.1 series trained by this project on Wan2.1, multi-resolution (512/768/1024), 81 frames at 16fps, covering T2V, I2V, first/last frame, controlled generation, and camera control |
|
||||||||||||||||||||||||||||
| Wan2.1-Fun V1.0 | Video | V1.0 series trained by this project on Wan2.1; same capabilities as V1.1 but without camera control |
|
||||||||||||||||||||||||||||
| Wan2.1 | Video | Official Wan weights covering T2V, I2V, audio-driven, and controlled generation; can be used as training baseline for Wan2.1-Fun |
|
||||||||||||||||||||||||||||
| Self-Forcing / Causal-Forcing / Flex-Forcing | Video | Autoregressive distillation schemes covering streaming, interactive generation, and flexible chunked attention |
|
||||||||||||||||||||||||||||
| TurboWan / TurboDiffusion | Video | Distilled few-step weights publicly released by the TurboDiffusion scheme |
|
||||||||||||||||||||||||||||
| CogVideoX-Fun V1.5 | Video | Official CogVideoX-Fun V1.5 weights, multi-resolution (512/768/1024), 85 frames at 8fps, covering I2V and reward alignment |
|
||||||||||||||||||||||||||||
| CogVideoX-Fun V1.1 | Video | Official CogVideoX-Fun V1.1 weights, multi-resolution (512/768/1024/1280), 49 frames at 8fps, covering I2V, pose control, controlled generation, and reward alignment |
|
||||||||||||||||||||||||||||
| CogVideoX-Fun V1.0 | Video | Legacy weights trained at 49 frames 8fps, superseded by V1.1/V1.5 |
|
||||||||||||||||||||||||||||
| HunyuanVideo | Video | Official diffusers-format weights; this project directly supports inference and LoRA training |
|
||||||||||||||||||||||||||||
| MiniMax-H3 | Video | Official video generation weights and the ControlNet trained by this project |
|
||||||||||||||||||||||||||||
| TaoMate-H3 | Video+Audio | Official streaming audio-video generation adapter built on MiniMax-H3 |
|
||||||||||||||||||||||||||||
| LTX-2 | Video+Audio | Official DiT audio-video joint generation weights |
|
||||||||||||||||||||||||||||
| LongCat-Video | Video | Official long-video generation weights; supports LoRA training |
|
||||||||||||||||||||||||||||
| FantasyTalking | Audio-driven Video | Audio-conditioned incremental weights; requires base video weights and audio encoder |
|
||||||||||||||||||||||||||||
| InfiniteTalk | Audio-driven Video | Audio-conditioned incremental weights; requires base video weights and audio encoder |
|
||||||||||||||||||||||||||||
| FlashHead | Audio-driven Video | Official high-fidelity audio-driven head weights |
|
||||||||||||||||||||||||||||
| MOVA | Video+Audio | Official MOVA weights |
|
||||||||||||||||||||||||||||
| LingBot | Video | Camera-controllable world model; directory structure matches Wan2.2-I2V-A14B |
|
||||||||||||||||||||||||||||
| Phantom | Video | Incremental weights for multi-subject reference video generation; based on Wan2.1-T2V |
|
||||||||||||||||||||||||||||
| Qwen-Image | Image | Official text-to-image and image-editing weights; supports baseline and LoRA training |
|
||||||||||||||||||||||||||||
| Qwen-Image-2.1 | Image | Official next-generation text-to-image weights; single-stream block-causal transformer with prefix KV cache |
|
||||||||||||||||||||||||||||
| Qwen-Image ControlNet | Image | Image controlled generation; supports Canny, Depth, Pose, MLSD, and Scribble |
|
||||||||||||||||||||||||||||
| Z-Image | Image | Official text-to-image weights |
|
||||||||||||||||||||||||||||
| Z-Image-Fun | Image | ControlNet and distillation LoRA trained by this project on Z-Image; supports Canny, Depth, Pose, MLSD, Scribble, and Gray |
|
||||||||||||||||||||||||||||
| Flux | Image | Official FLUX.1/FLUX.2 weights and the ControlNet trained by this project |
|
||||||||||||||||||||||||||||
| ERNIE-Image | Image | Official Baidu text-to-image weights |
|
||||||||||||||||||||||||||||
| Lens | Image | Official Microsoft camera-control weights |
|
||||||||||||||||||||||||||||
| Auxiliary Models | - | Non-generative models used for reward alignment, data annotation, and fast decoding |
|
Notes:
- Audio-driven and reference models (FantasyTalking, InfiniteTalk, Phantom, TaoMate-H3) are incremental weights and must be used together with the corresponding base video weights and audio encoder.
- The TurboWan weights released by the TurboDiffusion scheme are listed above; other distillation schemes such as Flex-Forcing and PDD have no publicly released weights โ train them following
scripts/{model_name}/README_TRAIN*.mdand then fill the resulting path intotransformer_path.- Weight names map one-to-one to folder names under
models/Diffusion_Transformer/. Weights within the same family are not interchangeable; choose according to the inference task. If a weight is not listed here, it is either produced by this project or should be obtained from the upstream official repository.
inp_1.mp4 |
inp_2.mp4 |
inp_3.mp4 |
inp_4.mp4 |
inp_5.mp4 |
inp_6.mp4 |
inp_7.mp4 |
inp_8.mp4 |
Wan2.1-Fun-V1.1-14B-Control && Wan2.1-Fun-V1.1-1.3B-Control
Generic Control Video + Reference Image:
| Reference Image | Control Video | Wan2.1-Fun-V1.1-14B-Control | Wan2.1-Fun-V1.1-1.3B-Control |
|
pose_control.mp4 |
14b_ref.mp4 |
1.3b_ref.mp4 |
Generic Control Video (Canny, Pose, Depth, etc.) and Trajectory Control:
Fun-Trajectory_00003.mp4 |
Fun-Trajectory-Merge_00003.mp4 |
Fun_00006.mp4 |
pose.mp4 |
canny.mp4 |
depth.mp4 |
pose_out.mp4 |
canny_out.mp4 |
depth_out.mp4 |
Wan2.1-Fun-V1.1-14B-Control-Camera && Wan2.1-Fun-V1.1-1.3B-Control-Camera
| Pan Up | Pan Left | Pan Right |
Pan_Up.mp4 |
Pan_Left.mp4 |
Pan_Right.mp4 |
| Pan Down | Pan Up + Pan Left | Pan Up + Pan Right |
Pan_Down.mp4 |
Pan_Left_Up.mp4 |
Pan_Right_Up.mp4 |
CogVideoX-Fun-V1.1-5B
Resolution-1024
00000005.mp4 |
00000006.mp4 |
00000009.mp4 |
00000010.mp4 |
Resolution-768
00000001.mp4 |
00000002.mp4 |
00000005.mp4 |
00000006.mp4 |
Resolution-512
00000036.mp4 |
00000035.mp4 |
00000034.mp4 |
00000033.mp4 |
CogVideoX-Fun-V1.1-5B-Control
demo_pose.mp4 |
demo_scribble.mp4 |
demo_depth.mp4 |
| A young woman with beautiful clear eyes and blonde hair, wearing white clothes and twisting her body, with the camera focused on her face. High quality, masterpiece, best quality, high resolution, ultra-fine, dreamlike. | A young woman with beautiful clear eyes and blonde hair, wearing white clothes and twisting her body, with the camera focused on her face. High quality, masterpiece, best quality, high resolution, ultra-fine, dreamlike. | A young bear. |
00000010.mp4 |
00000011.mp4 |
00000012.mp4 |
- CogVideo: https://github.com/THUDM/CogVideo/
- EasyAnimate: https://github.com/aigc-apps/EasyAnimate
- Wan2.1: https://github.com/Wan-Video/Wan2.1/
- Wan2.2: https://github.com/Wan-Video/Wan2.2/
- Diffusers: https://github.com/huggingface/diffusers
- Qwen-Image: https://github.com/QwenLM/Qwen-Image
- Self-Forcing: https://github.com/guandeh17/Self-Forcing
- Flux: https://github.com/black-forest-labs/flux
- Flux2: https://github.com/black-forest-labs/flux2
- HunyuanVideo: https://github.com/Tencent-Hunyuan/HunyuanVideo
- ComfyUI-KJNodes: https://github.com/kijai/ComfyUI-KJNodes
- ComfyUI-EasyAnimateWrapper: https://github.com/kijai/ComfyUI-EasyAnimateWrapper
- ComfyUI-CameraCtrl-Wrapper: https://github.com/chaojie/ComfyUI-CameraCtrl-Wrapper
- CameraCtrl: https://github.com/hehao13/CameraCtrl
If you use VideoX-Fun in your research or project, please cite it as follows:
@misc{aigc_apps_VideoX_Fun_2026,
author = {aigc-apps},
title = {VideoX-Fun: A Video Generation Pipeline for Diffusion Transformer},
year = {2026},
publisher = {GitHub},
url = {https://github.com/aigc-apps/VideoX-Fun}
}- Generated videos may have artifacts or quality issues, especially in complex scenes.
- The model may struggle with fine details, text rendering, or specific artistic styles.
- Performance varies with input prompt quality, resolution, and other parameters.
- The technology could be misused to create misleading content (e.g., deepfakes). Users are responsible for ethical use.
- The model may reflect biases present in the training data.
- Users should respect privacy and copyright when using real people's images or videos.
We encourage responsible use and recommend implementing safeguards in production environments.
This project is licensed under the Apache License (Version 2.0).
The CogVideoX-2B model (including its corresponding Transformers module and VAE module) is released under the Apache 2.0 License.
The CogVideoX-5B model (Transformers module) is released under the CogVideoX LICENSE.

