Wan2.2 Distill Loras

提供商lightx2v
分类image-to-video
许可证apache-2.0
下载量9.3K
星标11

简介

Wan2.2 Distill Loras 是一组针对 Wan2.2 视频生成模型进行蒸馏优化后的 LoRA 权重,旨在通过轻量化插件的方式,在不损失过多画质的前提下,显著提升视频生成的推理速度并降低显存占用。对于国内开发者而言,它解决了原模型生成耗时长、硬件门槛高的痛点,让中端消费级显卡也能流畅运行高质量的图生视频任务。它与 ComfyUI 或 Diffusers 等主流框架兼容性良好,用户只需加载相应的 LoRA 权重即可快速上手,是追求生成效率与效果平衡的理想选择。

核心亮点

  • 大幅提升图生视频的推理速度
  • 降低显存占用,适配消费级显卡
  • 在保持高画质的同时优化生成效率
  • 无缝兼容 ComfyUI 等主流 AI 工作流

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("lightx2v/Wan2.2-Distill-Loras")
tokenizer = AutoTokenizer.from_pretrained("lightx2v/Wan2.2-Distill-Loras")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download lightx2v/Wan2.2-Distill-Loras

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download lightx2v/Wan2.2-Distill-Loras config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('lightx2v/Wan2.2-Distill-Loras')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/lightx2v/Wan2.2-Distill-Loras

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/lightx2v/Wan2.2-Distill-Loras

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('lightx2v/Wan2.2-Distill-Loras')
tokenizer = AutoTokenizer.from_pretrained('lightx2v/Wan2.2-Distill-Loras')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model lightx2v/Wan2.2-Distill-Loras

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model lightx2v/Wan2.2-Distill-Loras README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('lightx2v/Wan2.2-Distill-Loras')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/lightx2v/Wan2.2-Distill-Loras.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/lightx2v/Wan2.2-Distill-Loras.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'lightx2v/Wan2.2-Distill-Loras')

完整文档

来源: HuggingFace

---
license: apache-2.0
tags:

  • diffusion-single-file

  • comfyui

  • distillation

  • LoRA

  • video

  • video genration

  • lora

pipeline_tags:
  • image-to-video

  • text-to-video

base_model:
  • Wan-AI/Wan2.2-I2V-A14B

library_name: diffusers
pipeline_tag: image-to-video
---

🎬 Wan2.2 Distilled LoRA Models

⚡ High-Performance Video Generation with 4-Step Inference Using LoRA

*LoRA weights extracted from Wan2.2 distilled models - Flexible deployment with excellent generation quality*

!img_lightx2v

---

![🤗 HuggingFace](https://huggingface.co/lightx2v/Wan2.2-Distill-Loras)
![GitHub](https://github.com/ModelTC/LightX2V)
![License](LICENSE)

---

🌟 What's Special?

<table>
<tr>
<td width="50%">

⚡ Flexible Deployment

  • Base Model + LoRA: Can be combined with base models
  • Offline Merging: Pre-merge LoRA into models
  • Online Loading: Dynamically load LoRA during inference
  • Multiple Frameworks: Supports LightX2V and ComfyUI

</td>
<td width="50%">

🎯 Dual Noise Control

  • High Noise: More creative, diverse outputs
  • Low Noise: More faithful to input, stable outputs
  • Rank 64 LoRA, compact size

</td>
</tr>
<tr>
<td width="50%">

💾 Storage Efficient

  • Small LoRA Size: Significantly smaller than full models
  • Flexible Combination: Can be combined with quantization
  • Easy Sharing: Convenient for model weight distribution

</td>
<td width="50%">

🚀 4-Step Inference

  • Ultra-Fast Generation: Generate high-quality videos in just 4 steps
  • Distillation Acceleration: Inherits advantages of distilled models
  • Quality Assurance: Maintains excellent generation quality

</td>
</tr>
</table>

---

📦 LoRA Model Catalog

🎥 Available LoRA Models

| Task Type | Noise Level | Model File | Rank | Purpose |
|:-------:|:--------:|:---------|:----:|:-----|
| I2V | High Noise | wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors | 64 | More creative image-to-video |
| I2V | Low Noise | wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors | 64 | More stable image-to-video |

> 💡 Note:
> - xxx in filenames represents version number or timestamp, please check HuggingFace repository for the latest version
> - These LoRAs must be used with Wan2.2 base models

---

🚀 Usage

Prerequisites

Base Model: You need to prepare Wan2.2 I2V base model (original model without distillation)

Download base model (choose one):

Method 1: From LightX2V Official Repository (Recommended)

bash
# Download high noise base model
huggingface-cli download lightx2v/Wan2.2-Official-Models \
wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \
--local-dir ./models/Wan2.2-Official-Models

Download low noise base model

huggingface-cli download lightx2v/Wan2.2-Official-Models \ wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \ --local-dir ./models/Wan2.2-Official-Models

Method 2: From Wan-AI Official Repository

bash
huggingface-cli download Wan-AI/Wan2.2-I2V-A14B \
--local-dir ./models/Wan2.2-I2V-A14B

> 💡 Note: lightx2v/Wan2.2-Official-Models provides separate high noise and low noise base models, download as needed

Method 1: LightX2V - Offline LoRA Merging (Recommended ⭐)

Offline LoRA merging provides best performance and supports quantization simultaneously.

#### 1.1 Download LoRA Models

bash
# Download both LoRAs (high noise and low noise)

Note: xxx represents version number, please check HuggingFace for actual filename

huggingface-cli download lightx2v/Wan2.2-Distill-Loras \ wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --local-dir ./loras/

#### 1.2 Merge LoRA (Basic Merging)

Merge LoRA:

bash
cd LightX2V/tools/convert

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_high_noise_lightx2v_4step \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --single_file

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_low_noise_lightx2v_4step \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --single_file

#### 1.3 Merge LoRA + Quantization (Recommended)

Merge LoRA + FP8 Quantization:

bash
cd LightX2V/tools/convert

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --quantized \ --linear_dtype torch.float8_e4m3fn \ --non_linear_dtype torch.bfloat16 \ --single_file

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --quantized \ --linear_dtype torch.float8_e4m3fn \ --non_linear_dtype torch.bfloat16 \ --single_file

Merge LoRA + ComfyUI FP8 Format:

bash
cd LightX2V/tools/convert

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/high_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_high_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_high_noise_scaled_fp8_e4m3_lightx2v_4step_comfyui \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --quantized \ --linear_dtype torch.float8_e4m3fn \ --non_linear_dtype torch.bfloat16 \ --single_file \ --comfyui_mode

For directory-based base model: --source /path/to/Wan2.2-I2V-A14B/low_noise_model/

python converter.py \ --source ./models/Wan2.2-Official-Models/wan2.2_i2v_A14b_low_noise_lightx2v.safetensors \ --output /path/to/output/ \ --output_ext .safetensors \ --output_name wan2.2_i2v_A14b_low_noise_scaled_fp8_e4m3_lightx2v_4step_comfyui \ --model_type wan_dit \ --lora_path /path/to/loras/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_xxx.safetensors \ --lora_strength 1.0 \ --quantized \ --linear_dtype torch.float8_e4m3fn \ --non_linear_dtype torch.bfloat16 \ --single_file \ --comfyui_mode