Seba Ai
模型概述
Seba-AI-5B是一個文本到視頻生成模型,源自THUDM的CogVideoX技術,支持從文本提示生成720x480分辨率、6秒時長的視頻
模型特點
高質量視頻生成
能夠根據文本提示生成720x480分辨率、6秒時長的高質量視頻
多精度支持
支持BF16、FP16、FP32等多種推理精度,適配不同硬件需求
顯存優化
通過diffusers庫優化,最低可在4GB顯存顯卡上運行
量化支持
支持INT8量化,進一步降低顯存需求
模型能力
文本生成視頻
視頻內容創作
創意視覺表達
使用案例
創意內容製作
動畫短片創作
根據劇本自動生成動畫短片
生成6秒時長的動畫視頻
廣告創意製作
快速生成廣告概念視頻
生成符合產品描述的廣告視頻
教育娛樂
教育視頻生成
根據教學內容生成可視化視頻
生成生動直觀的教學視頻
遊戲場景生成
為遊戲開發快速生成場景概念視頻
生成符合遊戲設定的場景視頻
🚀 Seba-AI-5B
Seba-AI-5B 是基於 CogVideoX 的視頻生成模型,具有較高的視頻生成質量和更好的視覺效果,支持使用 huggingface diffusers 庫進行部署。
🚀 快速開始
本模型支持使用 huggingface diffusers 庫進行部署,你可以按照以下步驟進行部署。
建議你訪問我們的 GitHub 查看相關的提示詞優化和轉換,以獲得更好的體驗。
- 安裝所需依賴
# diffusers>=0.30.1
# transformers>=4.44.2
# accelerate>=0.33.0 (建議從源代碼安裝)
# imageio-ffmpeg>=0.5.1
pip install --upgrade transformers accelerate diffusers imageio-ffmpeg
- 運行代碼
import torch
from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-5b",
torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()
pipe.vae.enable_tiling()
video = pipe(
prompt=prompt,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49,
guidance_scale=6,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]
export_to_video(video, "output.mp4", fps=8)
✨ 主要特性
- 高質量視頻生成:CogVideoX-5B 模型具有更高的視頻生成質量和更好的視覺效果。
- 多精度支持:支持多種推理精度,如 FP16、BF16、FP32 等。
- 多 GPU 推理:支持多 GPU 推理,可提高推理速度。
- 量化支持:可使用 PytorchAO 和 Optimum-quanto 對模型進行量化,降低內存需求。
📦 安裝指南
安裝所需依賴:
# diffusers>=0.30.1
# transformers>=4.44.2
# accelerate>=0.33.0 (建議從源代碼安裝)
# imageio-ffmpeg>=0.5.1
pip install --upgrade transformers accelerate diffusers imageio-ffmpeg
💻 使用示例
基礎用法
import torch
from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-5b",
torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload()
pipe.vae.enable_tiling()
video = pipe(
prompt=prompt,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49,
guidance_scale=6,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]
export_to_video(video, "output.mp4", fps=8)
高級用法
使用量化推理:
# 開始前,需要從 GitHub 源代碼安裝 PytorchAO 和 PyTorch Nightly。
# 直到下一個版本發佈前,需要進行源代碼和夜間版安裝。
import torch
from diffusers import AutoencoderKLCogVideoX, CogVideoXTransformer3DModel, CogVideoXPipeline
from diffusers.utils import export_to_video
+ from transformers import T5EncoderModel
+ from torchao.quantization import quantize_, int8_weight_only, int8_dynamic_activation_int8_weight
+ quantization = int8_weight_only
+ text_encoder = T5EncoderModel.from_pretrained("THUDM/CogVideoX-5b", subfolder="text_encoder", torch_dtype=torch.bfloat16)
+ quantize_(text_encoder, quantization())
+ transformer = CogVideoXTransformer3DModel.from_pretrained("THUDM/CogVideoX-5b", subfolder="transformer", torch_dtype=torch.bfloat16)
+ quantize_(transformer, quantization())
+ vae = AutoencoderKLCogVideoX.from_pretrained("THUDM/CogVideoX-5b", subfolder="vae", torch_dtype=torch.bfloat16)
+ quantize_(vae, quantization())
# 創建管道並進行推理
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-5b",
+ text_encoder=text_encoder,
+ transformer=transformer,
+ vae=vae,
torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()
pipe.vae.enable_tiling()
prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical atmosphere of this unique musical performance."
video = pipe(
prompt=prompt,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49,
guidance_scale=6,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]
export_to_video(video, "output.mp4", fps=8)
📚 詳細文檔
模型介紹
CogVideoX 是源自 QingYing 的視頻生成模型的開源版本。下表展示了我們目前提供的視頻生成模型列表及其基礎信息。
模型名稱 | CogVideoX-2B | CogVideoX-5B (本倉庫) |
---|---|---|
模型描述 | 入門級模型,兼顧兼容性。運行和二次開發成本低。 | 更大的模型,具有更高的視頻生成質量和更好的視覺效果。 |
推理精度 | FP16* (推薦),BF16,FP32,FP8*,INT8,不支持 INT4 | BF16 (推薦),FP16,FP32,FP8*,INT8,不支持 INT4 |
單 GPU 顯存消耗 | SAT FP16: 18GB diffusers FP16: 從 4GB 起* diffusers INT8(torchao): 從 3.6GB 起* |
SAT BF16: 26GB diffusers BF16: 從 5GB 起* diffusers INT8(torchao): 從 4.4GB 起* |
多 GPU 推理顯存消耗 | FP16: 使用 diffusers 為 10GB* | BF16: 使用 diffusers 為 15GB* |
推理速度 (Step = 50, FP/BF16) |
單 A100: ~90 秒 單 H100: ~45 秒 |
單 A100: ~180 秒 單 H100: ~90 秒 |
微調精度 | FP16 | BF16 |
微調顯存消耗 (每個 GPU) | 47 GB (bs=1, LORA) 61 GB (bs=2, LORA) 62GB (bs=1, SFT) |
63 GB (bs=1, LORA) 80 GB (bs=2, LORA) 75GB (bs=1, SFT) |
提示詞語言 | 英語* | 英語* |
提示詞長度限制 | 226 個詞元 | 226 個詞元 |
視頻長度 | 6 秒 | 6 秒 |
幀率 | 每秒 8 幀 | 每秒 8 幀 |
視頻分辨率 | 720 x 480,不支持其他分辨率 (包括微調) | 720 x 480,不支持其他分辨率 (包括微調) |
位置編碼 | 3d_sincos_pos_embed | 3d_rope_pos_embed |
數據說明
- 使用
diffusers
庫進行測試時,啟用了diffusers
庫提供的所有優化。此解決方案尚未在除 NVIDIA A100 / H100 以外的設備上測試實際顯存/內存使用情況。一般來說,此解決方案可適用於所有 NVIDIA Ampere 架構 及以上的設備。如果禁用優化,顯存使用量將顯著增加,峰值顯存使用量約為表中顯示的 3 倍。不過,速度將提高 3 - 4 倍。你可以選擇性地禁用一些優化,包括:
pipe.enable_model_cpu_offload()
pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
- 進行多 GPU 推理時,需要禁用
enable_model_cpu_offload()
優化。 - 使用 INT8 模型會降低推理速度。這是為了確保顯存較低的 GPU 能夠正常進行推理,同時保持最小的視頻質量損失,不過推理速度會顯著下降。
- 2B 模型使用
FP16
精度進行訓練,5B 模型使用BF16
精度進行訓練。建議使用模型訓練時的精度進行推理。 - PytorchAO 和 Optimum-quanto 可用於對文本編碼器、Transformer 和 VAE 模塊進行量化,以降低 CogVideoX 的內存需求。這使得在免費的 T4 Colab 或顯存較小的 GPU 上運行模型成為可能!值得注意的是,TorchAO 量化與
torch.compile
完全兼容,可顯著提高推理速度。FP8
精度必須在NVIDIA H100
及以上的設備上使用,這需要從源代碼安裝torch
、torchao
、diffusers
和accelerate
Python 包。建議使用CUDA 12.4
。 - 推理速度測試也使用了上述顯存優化方案。如果不進行顯存優化,推理速度將提高約 10%。只有
diffusers
版本的模型支持量化。 - 模型僅支持英文輸入;其他語言可在細化時由大模型翻譯成英文。
注意
- 使用 SAT 對 SAT 版本的模型進行推理和微調。歡迎訪問我們的 GitHub 瞭解更多信息。
🔧 技術細節
歡迎訪問我們的 github,你可以在那裡找到:
- 更詳細的技術細節和代碼解釋。
- 提示詞的優化和轉換。
- SAT 版本模型的推理和微調,甚至預發佈內容。
- 項目更新日誌動態,更多互動機會。
- CogVideoX 工具鏈,幫助你更好地使用模型。
- INT8 模型推理代碼支持。
📄 許可證
本模型根據 MIT 許可證發佈。
引用
@article{GlitchX1.02AbdelrahmanEssa,
title={Seba-Ai-Video-Generator: Text-to-Video Diffusion Models with An Expert Transformer},
author={Abdelrahman, Glitch},
journal={arXiv preprint arXiv:2408.06072},
year={2024}
}
演示展示
📄 Glitch Readme | 🤗 Glitch-Tech | 🌐 Hugging Fcae |
📍 訪問 Glitch H/F 和 API 平臺 體驗商業視頻生成模型。
A garden comes to life as a kaleidoscope of butterflies flutters amidst the blossoms, their delicate wings casting shadows on the petals below. In the background, a grand fountain cascades water with a gentle splendor, its rhythmic sound providing a soothing backdrop. Beneath the cool shade of a mature tree, a solitary wooden chair invites solitude and reflection, its smooth surface worn by the touch of countless visitors seeking a moment of tranquility in nature's embrace.
A small boy, head bowed and determination etched on his face, sprints through the torrential downpour as lightning crackles and thunder rumbles in the distance. The relentless rain pounds the ground, creating a chaotic dance of water droplets that mirror the dramatic sky's anger. In the far background, the silhouette of a cozy home beckons, a faint beacon of safety and warmth amidst the fierce weather. The scene is one of perseverance and the unyielding spirit of a child braving the elements.
A suited astronaut, with the red dust of Mars clinging to their boots, reaches out to shake hands with an alien being, their skin a shimmering blue, under the pink-tinged sky of the fourth planet. In the background, a sleek silver rocket, a beacon of human ingenuity, stands tall, its engines powered down, as the two representatives of different worlds exchange a historic greeting amidst the desolate beauty of the Martian landscape.
An elderly gentleman, with a serene expression, sits at the water's edge, a steaming cup of tea by his side. He is engrossed in his artwork, brush in hand, as he renders an oil painting on a canvas that's propped up against a small, weathered table. The sea breeze whispers through his silver hair, gently billowing his loose-fitting white shirt, while the salty air adds an intangible element to his masterpiece in progress. The scene is one of tranquility and inspiration, with the artist's canvas capturing the vibrant hues of the setting sun reflecting off the tranquil sea.
In a dimly lit bar, purplish light bathes the face of a mature man, his eyes blinking thoughtfully as he ponders in close-up, the background artfully blurred to focus on his introspective expression, the ambiance of the bar a mere suggestion of shadows and soft lighting.
A golden retriever, sporting sleek black sunglasses, with its lengthy fur flowing in the breeze, sprints playfully across a rooftop terrace, recently refreshed by a light rain. The scene unfolds from a distance, the dog's energetic bounds growing larger as it approaches the camera, its tail wagging with unrestrained joy, while droplets of water glisten on the concrete behind it. The overcast sky provides a dramatic backdrop, emphasizing the vibrant golden coat of the canine as it dashes towards the viewer.
On a brilliant sunny day, the lakeshore is lined with an array of willow trees, their slender branches swaying gently in the soft breeze. The tranquil surface of the lake reflects the clear blue sky, while several elegant swans glide gracefully through the still water, leaving behind delicate ripples that disturb the mirror-like quality of the lake. The scene is one of serene beauty, with the willows' greenery providing a picturesque frame for the peaceful avian visitors.
A Chinese mother, draped in a soft, pastel-colored robe, gently rocks back and forth in a cozy rocking chair positioned in the tranquil setting of a nursery. The dimly lit bedroom is adorned with whimsical mobiles dangling from the ceiling, casting shadows that dance on the walls. Her baby, swaddled in a delicate, patterned blanket, rests against her chest, the child's earlier cries now replaced by contented coos as the mother's soothing voice lulls the little one to sleep. The scent of lavender fills the air, adding to the serene atmosphere, while a warm, orange glow from a nearby nightlight illuminates the scene with a gentle hue, capturing a moment of tender love and comfort.
Xclip Base Patch32
MIT
X-CLIP是CLIP的擴展版本,用於通用視頻語言理解,通過對比學習在(視頻,文本)對上訓練,適用於視頻分類和視頻-文本檢索等任務。
文本生成視頻
Transformers 英語

X
microsoft
309.80k
84
LTX Video
其他
首個基於DiT的視頻生成模型,能夠即時生成高質量視頻,支持文本轉視頻和圖像+文本轉視頻兩種場景。
文本生成視頻 英語
L
Lightricks
165.42k
1,174
Wan2.1 14B VACE GGUF
Apache-2.0
Wan2.1-VACE-14B模型的GGUF格式版本,主要用於文本到視頻的生成任務。
文本生成視頻
W
QuantStack
146.36k
139
Animatediff Lightning
Openrail
極速文本生成視頻模型,生成速度比原版AnimateDiff快十倍以上
文本生成視頻
A
ByteDance
144.00k
925
V Express
V-Express是一個基於音頻和麵部關鍵點條件生成的視頻生成模型,能夠將音頻輸入轉換為動態視頻輸出。
文本生成視頻 英語
V
tk93
118.36k
85
Cogvideox 5b
其他
CogVideoX是源自清影的視頻生成模型的開源版本,提供高質量的視頻生成能力。
文本生成視頻 英語
C
THUDM
92.32k
611
Llava NeXT Video 7B Hf
LLaVA-NeXT-Video是一個開源多模態聊天機器人,通過視頻和圖像數據混合訓練獲得優秀的視頻理解能力,在VideoMME基準上達到開源模型SOTA水平。
文本生成視頻
Transformers 英語

L
llava-hf
65.95k
88
Wan2.1 T2V 14B Diffusers
Apache-2.0
萬2.1是一套全面開放的視頻基礎模型,旨在突破視頻生成的邊界,支持中英文文本生成視頻、圖像生成視頻等多種任務。
文本生成視頻 支持多種語言
W
Wan-AI
48.65k
24
Wan2.1 T2V 1.3B Diffusers
Apache-2.0
萬2.1是一套全面開放的視頻基礎模型,具備頂尖性能、支持消費級GPU、多任務支持、視覺文本生成和高效視頻VAE等特點。
文本生成視頻 支持多種語言
W
Wan-AI
45.29k
38
Wan2.1 T2V 14B
Apache-2.0
萬2.1是一套綜合性開源視頻基礎模型,具備文本生成視頻、圖像生成視頻、視頻編輯、文本生成圖像及視頻生成音頻等多任務能力,支持中英雙語文本生成。
文本生成視頻 支持多種語言
W
Wan-AI
44.88k
1,238
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98