🚀 GGUF量化和fp8縮放版本的LTX - Video
本項目提供了LTX - Video的GGUF量化和fp8縮放版本,可用於文本到視頻、圖像到視頻、視頻到視頻等多種轉換任務,為視頻生成提供了更多選擇和可能性。
🚀 快速開始
一次性設置
- 將ltx - video - 2b - v0.9.1 - r2 - q4_0.gguf([1.09GB](https://huggingface.co/calcuis/ltxv - gguf/blob/main/ltx - video - 2b - v0.9.1 - r2 - q4_0.gguf))拖到 > ./ComfyUI/models/diffusion_models
- 將t5xxl_fp16 - q4_0.gguf([2.9GB](https://huggingface.co/calcuis/ltxv - gguf/blob/main/t5xxl_fp16 - q4_0.gguf))拖到 > ./ComfyUI/models/text_encoders
- 將ltxv_vae_fp32 - f16.gguf([838MB](https://huggingface.co/calcuis/ltxv - gguf/blob/main/ltxv_vae_fp32 - f16.gguf))拖到 > ./ComfyUI/models/vae
直接運行(無需安裝方式)
- 運行主目錄中的.bat文件(假設你使用下面的gguf - node 包)
- 將工作流json文件(如下)拖到 > 你的瀏覽器
工作流
- [gguf](https://huggingface.co/calcuis/ltxv - gguf/blob/main/workflow - ltxv - gguf.json)的示例工作流(見上面的演示)
- 原始[safetensors](https://huggingface.co/calcuis/ltxv - gguf/blob/main/workflow - ltxv - safetensors.json)的示例工作流
✨ 主要特性
- 支持多種輸入類型,包括文本到視頻、圖像到視頻、視頻到視頻。
- 提供了不同量化和縮放版本,可根據需求選擇。
- 可以混合使用不同的模型文件和vae,測試最佳組合。
- 新增了一組增強的vae(從fp8到fp32),低內存版本的gguf vae也可直接使用。
- 支持使用diffusers🧨庫和gguf - connector兩種方式運行。
📦 安裝指南
按照“快速開始”中的“一次性設置”步驟,將相應的文件拖到指定目錄即可完成安裝。
💻 使用示例
基礎用法
使用diffusers🧨庫運行的示例代碼如下:
import torch
from transformers import T5EncoderModel
from diffusers import LTXPipeline, GGUFQuantizationConfig, LTXVideoTransformer3DModel
from diffusers.utils import export_to_video
model_path = (
"https://huggingface.co/calcuis/ltxv-gguf/blob/main/ltx-video-2b-v0.9-q8_0.gguf"
)
transformer = LTXVideoTransformer3DModel.from_single_file(
model_path,
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
torch_dtype=torch.bfloat16,
)
text_encoder = T5EncoderModel.from_pretrained(
"calcuis/ltxv-gguf",
gguf_file="t5xxl_fp16-q4_0.gguf",
torch_dtype=torch.bfloat16,
)
pipe = LTXPipeline.from_pretrained(
"callgg/ltxv-decoder",
text_encoder=text_encoder,
transformer=transformer,
torch_dtype=torch.bfloat16
).to("cuda")
prompt = "A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage"
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
video = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
width=704,
height=480,
num_frames=25,
num_inference_steps=50,
).frames[0]
export_to_video(video, "output.mp4", fps=24)
高級用法
使用gguf - connector運行:
ggc vg
此命令用於文本到視頻(t2v)面板。
ggc v1
📚 詳細文檔
評測
q2_k
gguf速度非常快,但不可用;僅用於測試。
- 令人驚訝的是,
0.9_fp8_e4m3fn
和0.9 - vae_fp8_e4m3fn
效果相當不錯。
- 可以混合搭配使用不同的模型文件和vae,測試最佳組合。
- 可以選擇使用t5xxl縮放的safetensors或t5xxl gguf(更多t5xxl的量化版本可在這裡找到)作為文本編碼器。
- 此包中新增了一組增強的vae(從fp8到fp32);低內存版本的gguf vae也可直接使用;為新功能升級你的節點:gguf vae loader。
- gguf - node可用(詳情見這裡),用於運行新功能(以下要點可能與模型沒有直接關係)。
- 你可以使用新節點通過comfyui製作自己的
fp8_e4m3fn
縮放的safetensors和/或將其轉換為gguf。
參考
- 基礎模型來自[lightricks](https://huggingface.co/Lightricks/LTX - Video)
- comfyui來自comfyanonymous
- comfyui - gguf來自[city96](https://github.com/city96/ComfyUI - GGUF)
- gguf - comfy [包](https://github.com/calcuis/gguf - comfy/releases)
- gguf - connector([pypi](https://pypi.org/project/gguf - connector))
- gguf - node([pypi](https://pypi.org/project/gguf - node)|倉庫|包)
📄 許可證
本項目使用其他許可證,詳情請見LICENSE。