智東西(公眾號:zhidxcom)
作者 | ZeR0
編輯 | 漠影

智東西8月6日報道,好消息,智譜AI的視頻生成模型CogVideoX-2B,昨晚正式開源了。

模型已上架GitHub、Hugging Face,FP16精度下的推理僅需18GB顯存,微調則只需要40GB,單張4090顯卡可推理,單張A6000可微調。

CogVideoX-2B的提示詞上限為226個token,視頻長度為6秒,幀率為8幀/秒,視頻分辨率為720 * 480。

CogVideoX系列開源模型與智譜AI的商業版視頻生成模型“清影”同源。2B版本首發后,性能更強、參數量更大的開源模型將在后續上架。

代碼倉庫://github.com/THUDM/CogVideo
模型下載://huggingface.co/THUDM/CogVideoX-2b
技術報告://github.com/THUDM/CogVideo/blob/main/resources/CogVideoX.pdf

根據論文,CogVideoX在雷達圖中比其他幾個視頻生成模型更大,屬性值趨近六邊形。

為了評估文生視頻的質量,智譜AI使用了VBench中的多個指標,如人類動作、場景、動態程度等;還使用了兩個額外的視頻評估工具:Devil中的Dynamic Quality和Chrono-Magic中的GPT4o-MT Score,這些工具專注于視頻的動態特性。從下表可見,CogVideoX在多個指標的得分領先。

在人類盲評中,CogVideoX在五個指標的得分均超過了快手可靈。

GitHub頁面展示了幾個由CogVideoX-2B生成的視頻作品:

▲提示詞:A detailed wooden toy ship with intricately carved masts and sails is seen gliding smoothly over a plush, blue carpet that mimics the waves of the sea. The ship’s hull is painted a rich brown, with tiny windows. The carpet, soft and textured, provides a perfect backdrop, resembling an oceanic expanse. Surrounding the ship are various other toys and children’s items, hinting at a playful environment. The scene captures the innocence and imagination of childhood, with the toy ship’s journey symbolizing endless adventures in a whimsical, indoor setting.

▲提示詞:The camera follows behind a white vintage SUV with a black roof rack as it speeds up a steep dirt road surrounded by pine trees on a steep mountain slope, dust kicks up from its tires, the sunlight shines on the SUV as it speeds along the dirt road, casting a warm glow over the scene. The dirt road curves gently into the distance, with no other cars or vehicles in sight. The trees on either side of the road are redwoods, with patches of greenery scattered throughout. The car is seen from the rear following the curve with ease, making it seem as if it is on a rugged drive through the rugged terrain. The dirt road itself is surrounded by steep hills and mountains, with a clear blue sky above with wispy clouds.

▲提示詞:A street artist, clad in a worn-out denim jacket and a colorful bandana, stands before a vast concrete wall in the heart, holding a can of spray paint, spray-painting a colorful bird on a mottled wall.

▲提示詞:In the haunting backdrop of a war-torn city, where ruins and crumbled walls tell a story of devastation, a poignant close-up frames a young girl. Her face is smudged with ash, a silent testament to the chaos around her. Her eyes glistening with a mix of sorrow and resilience, capturing the raw emotion of a world that has lost its innocence to the ravages of conflict.

CogVideoX采用3D VAE和專家Transformer架構來生成連貫長視頻,通過自研視頻理解模型構建了一個具有文本描述的相對高質量的視頻片段集合。

視頻數據因包含空間和時間信息,其數據量和計算負擔遠超圖像數據。智譜AI提出了基于3D變分自編碼器(3D VAE)的視頻壓縮方法,通過三維卷積同時壓縮視頻的空間和時間維度,實現了更高的壓縮率和更好的重建質量。

▲CogVideoX里的3D VAE架構

模型結構包括編碼器、解碼器、潛在空間正則化器,通過四個階段的下采樣和上采樣實現壓縮。時間因果卷積確保了信息的因果性,減少了通信開銷,上下文并行技術能更好適應大規模視頻處理。

實驗中,智譜AI發現大分辨率編碼易于泛化,增加幀數則挑戰較大,因此模型訓練分兩個階段:先在較低幀率和小批量上訓練,后通過上下文并行在更高幀率上微調。訓練損失函數結合了L2損失、LPIPS感知損失和3D判別器的GAN損失。

智譜AI使用VAE的編碼器將視頻壓縮至潛在空間,然后將潛在空間分割成塊并展開成長的序列嵌入z_vision,同時使用T5,將文本輸入編碼為文本嵌入z_text,再將z_text和z_vision沿序列維度拼接,拼接后的嵌入被送入專家Transformer塊堆棧中處理,最后反向拼接嵌入來恢復原始潛在空間形狀,并使用VAE進行解碼以重建視頻。

▲CogVideoX架構

訓練數據方面,智譜AI開發了負面標簽來識別和排除低質量視頻,通過video-llama訓練的過濾器標注并篩選了20000個視頻數據樣本;同時,計算光流和美學分數,動態調整閾值,確保生成視頻的質量。

針對缺乏視頻字幕數據的問題,智譜AI提出了一種從圖像字幕生成視頻字幕的管道,并微調端到端的視頻字幕模型以獲得更密集的字幕。這種方法通過Panda70M模型生成簡短字幕,用CogView3模型生成密集圖像字幕,然后用GPT-4模型總結生成最終的短視頻。

該團隊還微調了一個基于CogVLM2-Video和Llama 3的CogVLM2-Caption模型,使用密集字幕數據進行訓練,以加速視頻字幕生成過程。

▲密集字幕數據生成流程

智譜AI團隊仍在努力完善CogVideoX捕捉復雜動態的能力,探究新型模型架構、更高效地壓縮視頻信息、更充分地融合文本和視頻內容,以持續探索視頻生成模型的scaling law,旨在訓練出更大更強的模型,來生成更長、更高質量的視頻。

如今視頻生成模型及應用正變得越來越多,技術也逐漸成熟,但此前還沒有一個開源的視頻生成模型能夠滿足商業級應用的要求。我們期待更多視頻生成模型走向開源,推動更多開發者及企業參與開發視頻生成模型及應用,并為圍繞視頻生成的各種技術優化和功能開發做貢獻。