HunyuanVideo-1.5 README

The project's README from github.com/Tencent-Hunyuan/HunyuanVideo-1.5. As one markdown file: README.md.

中文文档

HunyuanVideo-1.5

HunyuanVideo-1.5 Logo

🎬 HunyuanVideo-1.5: A leading lightweight video generation model

HunyuanVideo-1.5 is a video generation model that delivers top-tier quality with only 8.3B parameters, significantly lowering the barrier to usage. It runs smoothly on consumer-grade GPUs, making it accessible for every developer and creator. This repository provides the implementation and tools needed to generate creative videos.


👏 Join our WeChat and Discord | 💻 Official website Try our model!  

🔥🔥🔥 News

🎥 Demo

🧩 Community Contributions

If you develop/use HunyuanVideo-1.5 in your projects, welcome to let us know.

📑 Open-source Plan

📋 Table of Contents

📖 Introduction

We present HunyuanVideo-1.5, a lightweight yet powerful video generation model that achieves state-of-the-art visual quality and motion coherence with only 8.3 billion parameters, enabling efficient inference on consumer-grade GPUs. This achievement is built upon several key components, including meticulous data curation, an advanced DiT architecture with selective and sliding tile attention(SSTA), enhanced bilingual understanding through glyph-aware text encoding, progressive pre-training and post-training, and an efficient video super-resolution network. Leveraging these designs, we developed a unified framework capable of high-quality text-to-video and image-to-video generation across multiple durations and resolutions. Extensive experiments demonstrate that this compact and proficient model establishes a new state-of-the-art among open-source models. By releasing the code and weights of HunyuanVideo-1.5, we provide the community with a high-performance foundation that significantly lowers the cost of video creation and research, making advanced video generation more accessible to all.

✨ Key Features

HunyuanVideo-1.5 DiT
HunyuanVideo-1.5 VSR

📜 System Requirements

Hardware Requirements

Software Requirements

🛠️ Dependencies and Installation

Step 1: Clone the Repository

git clone https://github.com/Tencent-Hunyuan/HunyuanVideo-1.5.git
cd HunyuanVideo-1.5

Step 2: Install Basic Dependencies

pip install -r requirements.txt
pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python

Step 3: Install Attention Libraries

🧱 Download Pretrained Models

💡 Distillation models and sparse attention models are still coming soon. Please stay tuned for the latest updates on the Hugging Face Model Card.

Download the pretrained models before generating videos. Detailed instructions are available at checkpoints-download.md.

Model Cards

ModelName Download
HunyuanVideo-1.5-480P-T2V 480P-T2V
HunyuanVideo-1.5-480P-I2V 480P-I2V
HunyuanVideo-1.5-480P-T2V-cfg-distill 480P-T2V-cfg-distill
HunyuanVideo-1.5-480P-I2V-cfg-distill 480P-I2V-cfg-distill
HunyuanVideo-1.5-480P-I2V-step-distill 480P-I2V-step-distill
HunyuanVideo-1.5-720P-T2V 720P-T2V
HunyuanVideo-1.5-720P-I2V 720P-I2V
HunyuanVideo-1.5-720P-T2V-cfg-distill Coming soon
HunyuanVideo-1.5-720P-I2V-cfg-distill 720P-I2V-cfg-distill
HunyuanVideo-1.5-720P-T2V-sparse-cfg-distill Coming soon
HunyuanVideo-1.5-720P-I2V-sparse-cfg-distill 720P-I2V-sparse-cfg-distill
HunyuanVideo-1.5-720P-sr-step-distill 720P-sr
HunyuanVideo-1.5-1080P-sr-step-distill 1080P-sr

📝 Prompt Guide

Prompt Writing Handbook

Prompt enhancement plays a crucial role in enabling our model to generate high-quality videos. By writing longer and more detailed prompts, the generated video will be significantly improved. We encourage you to craft comprehensive and descriptive prompts to achieve the best possible video quality. We recommend community partners consulting our official guide on how to write effective prompts.

Reference: HunyuanVideo-1.5 Prompt Handbook

System Prompts for Automatic Prompt Enhancement

For users seeking to optimize prompts for other large models, it is recommended to consult the definition of t2v_rewrite_system_prompt in the file hyvideo/utils/rewrite/t2v_prompt.py to guide text-to-video rewriting. Similarly, for image-to-video rewriting, refer to the definition of i2v_rewrite_system_prompt in hyvideo/utils/rewrite/i2v_prompt.py.

🔑 Inference

Inference with Source Code

For prompt rewriting, we recommend using Gemini or models deployed via vLLM. This codebase currently only supports models compatible with the vLLM API. If you wish to use Gemini, you will need to implement your own interface calls.

For models with a vLLM API, note that T2V (text-to-video) and I2V (image-to-video) have different recommended models and environment variables:

You may set the above model names to any other vLLM-compatible models you have deployed (including HuggingFace models).
Rewriting is enabled by default (--rewrite defaults to true); to disable it explicitly, use --rewrite false or --rewrite 0. If no vLLM endpoint is configured, the pipeline runs without remote rewriting.

Example: Generate a video (works for both T2V and I2V; set IMAGE_PATH=none for T2V or provide an image path for I2V)

💡 Tip: For faster inference speed, you can enable the step-distilled model using the --enable_step_distill parameter. The step-distilled model (480p I2V) can generate videos in 8 or 12 steps (recommended), achieving up to 75% speedup on RTX 4090 while maintaining comparable quality.

Tips: If your GPU memory is > 14GB but you encounter OOM (Out of Memory) errors during generation, you can try setting the following environment variable before running:

export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True,max_split_size_mb:128

Tips: If you have limited CPU memory and encounter OOM during inference, you can try disable overlapped group offloading by adding the following argument:

--overlap_group_offloading false
export T2V_REWRITE_BASE_URL="<your_vllm_server_base_url>"
export T2V_REWRITE_MODEL_NAME="<your_model_name>"
export I2V_REWRITE_BASE_URL="<your_vllm_server_base_url>"
export I2V_REWRITE_MODEL_NAME="<your_model_name>"

PROMPT='A girl holding a paper with words "Hello, world!"'

IMAGE_PATH=/path/to/image.png # Optional, none or <image path> to enable i2v mode
SEED=1
ASPECT_RATIO=16:9
RESOLUTION=480p
OUTPUT_PATH=./outputs/output.mp4
MODEL_PATH=./ckpts # Path to pretrained model

# Configuration for faster inference
N_INFERENCE_GPU=8 # Parallel inference GPU count
CFG_DISTILLED=true # Inference with CFG distilled model, 2x speedup
SAGE_ATTN=true # Inference with SageAttention
SPARSE_ATTN=false # Inference with sparse attention (only 720p models are equipped with sparse attention). Please ensure flex-block-attn is installed
OVERLAP_GROUP_OFFLOADING=true # Only valid when group offloading is enabled, significantly increases CPU memory usage but speeds up inference
ENABLE_CACHE=true # Enable feature cache during inference. Significantly speeds up inference.
CACHE_TYPE=deepcache # Support: deepcache, teacache, taylorcache
ENABLE_STEP_DISTILL=true # Enable step distilled model for 480p I2V, recommended 8 or 12 steps, up to 6x speedup


# Configuration for better quality
REWRITE=true # Enable prompt rewriting. Please ensure rewrite vLLM server is deployed and configured.
ENABLE_SR=true # Enable super resolution


torchrun --nproc_per_node=$N_INFERENCE_GPU generate.py \
  --prompt "$PROMPT" \
  --image_path $IMAGE_PATH \
  --resolution $RESOLUTION \
  --aspect_ratio $ASPECT_RATIO \
  --seed $SEED \
  --rewrite $REWRITE \
 

HunyuanVideo-1.5 (Tencent-Hunyuan/HunyuanVideo-1.5)

Searching Database…

这是什么?HunyuanVideo-1.5 是腾讯推出的视频生成模型,可以生成文生视频和图生视频片段,仅用 8.3B 参数就达到顶级质量,因此能在消费级 GPU 上运行。
这是一个独立应用,还是需要通过代码运行的模型?它是一个发布了权重和推理/训练源代码的模型;你可以通过 generate.py 或 train.py 运行它,也可以通过 Diffusers、ComfyUI、LightX2V 等集成方式使用。
怎么让它跑起来?克隆仓库,安装基础依赖和一个注意力库(Flash Attention、Flex-Block-Attention 或 SageAttention),下载预训练模型权重,然后带上提示词(图生视频还需图片路径)运行 generate.py。
需要特定的 GPU 和 Python 版本吗?需要:一块支持 CUDA 的 NVIDIA GPU、至少 14GB 显存(在启用卸载的情况下)、Linux 操作系统,以及 Python 3.10 或更高版本。
每个模型变体都已经可用了?还没有——稀疏注意力模型、蒸馏模型和 SR 模型在模型卡片表格中仍标记为即将推出。
它只能在 Linux 的 NVIDIA GPU 上运行吗?是的,官方写明的要求是配备支持 CUDA 的 NVIDIA GPU 的 Linux 系统;没有提到对 Windows 或 Mac 的支持。
在单张 RTX 4090 上能加快生成速度吗?可以。480p I2V 步数蒸馏模型只需 8 或 12 步即可生成视频,在 RTX 4090 上约 75 秒内完成,比基础模型快大约 75%。
如果显存不够,有没有更轻量的图形界面替代方案?有。Wan2GP(WanGP)是社区收录的一款极低显存应用,最低 6GB 显存即可支持 HunyuanVideo-1.5。
可以在这个模型上微调或训练自己的 LoRA 吗?可以。发布的 train.py 提供了完整的训练流水线,支持分布式训练、FSDP、上下文并行和梯度检查点;继续训练或 LoRA 微调推荐使用 Muon 优化器。
可以不通过命令行,改用 ComfyUI 来使用它吗?可以。ComfyUI 官方支持 HunyuanVideo-1.5,并做了面向快速推理的工程优化;此外还有一个社区开发的 ComfyUI 插件,支持自动下载模型。
Size
0.2 MB
Stars
4.6K
Updated
CommitApr 10
Age
10mo
Commits · 90 Days