Hy-Nomas 世界提示產生器
為騰訊 Hy-Nomas 影片世界模型產生有效的結構化 JSON 世界提示,該模型在 ComfyUI 中透過 ComfyUI-Hy-Nomas 執行。
為什麼結構化 JSON 很重要
Hy-Nomas 是基於結構化 JSON 字幕訓練的,而非自由文字。該模型使用源自 JSON 結構的逐動作注意力遮罩——每個動作的影片幀僅關注該動作的文字。鬆散的純英文提示在第一個片段之後大多會被忽略;主體只會繼續做它之前做的事。精確遵循此格式是讓後續片段發揮作用的關鍵。
影片生成類型
識別使用者需要的類型並據此生成:
| 類型 | 何時使用 | 主要特徵 |
|---|---|---|
| 文字轉世界 | 無起始圖片,純生成 | 片段 0 中有完整的 visual_description_long,subject_list 中定義主體 |
| 圖片轉世界 | 使用者提供起始圖片 | 片段 0 描述圖片(持續 1 秒,空的 contained_actions),片段 1+ 從此繼續 |
| 攝影機控制 | 環繞、跟隨或特定攝影機路徑 | 透過 <Camera1> 標籤或外部攝影機按鍵/錄製節點控制攝影機移動;description_change 描述新視角的場景 |
| 互動駕駛 | 即時鍵盤操控 | 短暫 1 秒轉向,最小提示結構,使用者使用 W/A/S/D 操控 |
| 多片段連鎖 | 長連續世界(10-20 秒以上) | 多個帶有 description_change 的片段,不重疊的定時動作 |
核心 JSON 架構
每個世界提示必須是一個 JSON 物件,具有以下精確頂層鍵:
{
"perspective_view": "third-person observer",
"Style": "CG",
"subject_list": [...],
"segments": [...]
}
必要欄位參考
有關完整的逐欄位規格(包括允許值、格式化規則和邊緣情況),請參閱 references/prompt-format-spec.md。
快速參考
perspective_view(精確字串):
"first-person"— 攝影機就是主體"second-person"— 攝影機面向主體"third-person follow"— 攝影機在主體後方,追蹤移動"third-person observer"— 外部固定/獨立攝影機
Style(精確字串):
"real-world footage""animation/anime""CG""video game"
subject_list:包含一個主體物件的陣列,該物件具有 subject_id、display_name、subject_attribute。
segments:片段物件的陣列,每個物件具有 start_time、end_time,以及 visual_description_long(僅第一個片段)或 description_change(所有後續片段)。
關鍵規則
這些規則源自模型的訓練方式和注意力遮罩的運作方式。違反規則會導致無聲失敗。
-
第一個片段使用
visual_description_long(80-200 字,僅描述場景,絕不描述主體)。所有後續片段使用description_change。 -
description_change總是以 "Compared to the previous segment, " 開頭——即使沒有變化:"Compared to the previous segment, the visible scene, background, and other-object layout remain unchanged." -
動作使用類似 XML 的標籤:
<Action1><|Subject1|> 做某事</Action1>— 在每個片段內從 1 開始順序編號,始終透過<|Subject1|>引用主體。 -
在一個片段內,動作的時間不能重疊。每個動作有其自己的
start_time/end_time視窗。 -
時間戳為 "MM:SS.mmm" 格式:
"00:00.000"、"00:05.000"、"00:07.500"。內部正規化為片段相對時間。 -
片段長度:2-5 秒效果良好。24 fps,每個潛在幀 4 個影片幀。
-
文字中的攝影機移動使用
<Camera1>...</Camera1>標籤,放在description_change或visual_description_long中。但攝影機按鍵/錄製節點比文字攝影機描述更可靠。 -
對於圖片轉世界:片段 0 應約 1 秒,忠實描述圖片,具有空的
contained_actions: []。主體在subject_attribute中的外觀必須與圖片匹配。 -
主體屬性包含視角樣板:對於第三人稱跟隨:
"The camera is placed behind the X, and follows the X throughout the whole video. The camera is tracking the X and the X should be placed in the center of the video."對於第三人稱觀察者:"The camera films the X from an external position, and the X is visible in the video. The framing of the video from the camera is independent of the X, and does not follow the movement of the X."對於第一人稱:"The first-person operator is embodied by the camera, and has the same first-person viewpoint as the camera throughout the whole video."
工作流程
- 從使用者請求中識別生成類型(純文字?有圖片?攝影機控制?駕駛模式?)
- 必要時提出澄清問題:視角、風格、主體描述、期望時長、片段數量
- 按照架構精確生成完整的 JSON
- 在呈現前進行驗證:
- 有效的 JSON(可解析)
- 所有必要鍵都存在
- 時間戳格式正確且不重疊
- 第一個片段有
visual_description_long,其餘有description_change - 動作正確標記和編號
- 主體一致地以
<|Subject1|>引用
- 在程式碼區塊中呈現 JSON,準備貼入 ComfyUI 的世界提示節點
常見陷阱
- 在動作中直接使用主體名稱而非
<|Subject1|>→ 模型忽略該動作 - 將主體描述放入
visual_description_long→ 場景描述應僅為環境 description_change缺少 "Compared to the previous segment, " 前綴 → 世界連續性不一致- 動作時間重疊 → 注意力遮罩中的未定義行為
- 在片段 1+ 中使用
visual_description_long→ 解析器仍會將其移除 - 突然的全局場景變化(例如 "heavy snowstorm") → 模型維持世界一致性;變化在片段內逐漸發生
範例提示
有關涵蓋所有生成類型的完整工作範例,請參閱 references/examples.md。
技術細節
- 文字編碼器:Qwen2.5-VL-7B(與 Qwen-Image 相同)
- DiT:32 通道 DCAE-V 潛在空間,INT8 蒸餾權重
- 取樣:euler / simple / 8 steps / cfg 1
- 解析度:1280×704(720p)或 832×480
- FPS:24
- 歷史記錄:每片段保留 18 個潛在幀
- 來源:ComfyUI-Hy-Nomas · Tencent Hy-Nomas