🚀 PostMalone Lora for WanVideo2.1
本項目是針對WanVideo2.1的PostMalone LoRA模型,可用於文本到視頻的生成,通過特定觸發詞能生成帶有PostMalone風格的視頻。
🚀 快速開始
觸發詞
你需要使用 malone
來觸發視頻生成。
使用Diffusers庫
pip install git+https://github.com/huggingface/diffusers.git
import torch
from diffusers.utils import export_to_video
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
flow_shift = 5.0
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
pipe.to("cuda")
pipe.load_lora_weights("shauray/PostMalone_WanLora")
pipe.enable_model_cpu_offload()
prompt = "malone a man walking through texas"
output = pipe(
prompt=prompt,
height=480,
width=720,
num_frames=81,
guidance_scale=5.0,
).frames[0]
export_to_video(output, "output.mp4", fps=16)
模型下載
該模型的權重以Safetensors格式提供。
在 文件與版本 選項卡中下載。
✨ 主要特性
- 效果展示:提供了不同訓練步數(750步、1000步、1250步)生成的視頻示例,其中1000步訓練的模型可下載。
- 觸發機制:使用特定觸發詞
malone
即可生成具有特定風格的視頻。
- 兼容性:可與Diffusers庫配合使用,適用於不同分辨率的視頻生成。
📦 安裝指南
使用以下命令安裝所需的Diffusers庫:
pip install git+https://github.com/huggingface/diffusers.git
💻 使用示例
基礎用法
import torch
from diffusers.utils import export_to_video
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
flow_shift = 5.0
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
pipe.to("cuda")
pipe.load_lora_weights("shauray/PostMalone_WanLora")
pipe.enable_model_cpu_offload()
prompt = "malone a man walking through texas"
output = pipe(
prompt=prompt,
height=480,
width=720,
num_frames=81,
guidance_scale=5.0,
).frames[0]
export_to_video(output, "output.mp4", fps=16)
高級用法
在實際使用中,你可以根據需求調整參數,如 height
、width
、num_frames
、guidance_scale
等,以生成不同分辨率、幀數和風格的視頻。例如:
import torch
from diffusers.utils import export_to_video
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
model_id = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
flow_shift = 3.0
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
pipe.to("cuda")
pipe.load_lora_weights("shauray/PostMalone_WanLora")
pipe.enable_model_cpu_offload()
prompt = "malone a man dancing in the rain"
output = pipe(
prompt=prompt,
height=480,
width=640,
num_frames=100,
guidance_scale=6.0,
).frames[0]
export_to_video(output, "rain_dance.mp4", fps=20)
📄 許可證
本項目採用Apache-2.0許可證。
📚 詳細文檔
模型信息
屬性 |
詳情 |
模型類型 |
基於Wan-AI/Wan2.1-T2V-14B的LoRA模型 |
訓練數據 |
未提及 |
示例視頻說明
- 前2個視頻來自 [750步訓練]
- 中間2個視頻來自 [1000步訓練],該模型可下載
- 最後2個視頻來自 [1250步訓練]