Hy-Nomas 世界提示生成器
生成有效的结构化 JSON 世界提示,用于在 ComfyUI 中通过 ComfyUI-Hy-Nomas 运行腾讯的 Hy-Nomas 视频世界模型。
为什么结构化 JSON 很重要
Hy-Nomas 是在结构化 JSON 描述上训练的,而不是自由文本。模型使用基于 JSON 结构的每动作注意力掩码——每个动作的视频帧只关注该动作的文本。松散的纯英文提示在第一个分段之后基本被忽略;主题只会继续做之前的事情。精确遵循此格式才能使后续分段正常工作。
视频生成类型
确定用户需要的类型并相应生成:
| 类型 | 何时使用 | 关键特征 |
|---|---|---|
| 文本到世界 (Text-to-World) | 无起始图像,纯生成 | 分段 0 中包含完整的 visual_description_long,subject_list 中定义主题 |
| 图像到世界 (Image-to-World) | 用户提供起始图像 | 分段 0 描述图像(持续 1 秒,空的 contained_actions),分段 1+ 从该图像继续 |
| 摄像机控制 (Camera-Controlled) | 轨道、跟随或特定摄像机路径 | 通过 <Camera1> 标签或外部 Camera Keys/Recording 节点进行摄像机移动;description_change 描述新视角下的场景 |
| 交互式驾驶 (Interactive Drive) | 实时键盘控制 | 短促的 1 秒转弯,最小的提示结构,用户使用 W/A/S/D 控制 |
| 多段链接 (Multi-Segment Chained) | 长时间连续世界(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 个视频帧。
-
文本中的摄像机移动在
description_change或visual_description_long内使用<Camera1>...</Camera1>标签。但 Camera Keys/Recording 节点比文本摄像机描述可靠得多。 -
针对图像到世界:分段 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 的 World Prompt 节点中
常见陷阱
- 在动作中通过名称而不是
<|Subject1|>引用主题 → 模型忽略该动作 - 将主题描述放入
visual_description_long→ 场景描述应仅为环境 - 在
description_change中缺少 "Compared to the previous segment, " 前缀 → 世界连续性不一致 - 动作时间重叠 → 注意力掩码中的未定义行为
- 在分段 1+ 中使用
visual_description_long→ 无论如何都会被解析器剥离 - 突然的全局场景变化(例如“暴风雪”) → 模型保持世界一致性;变化在分段内逐渐发生
示例提示
有关涵盖所有生成类型的完整工作示例,请阅读 references/examples.md。
技术细节
- 文本编码器:Qwen2.5-VL-7B(与 Qwen-Image 相同)
- DiT:32 通道 DCAE-V 潜在空间,INT8 蒸馏权重
- 采样:euler / simple / 8 步 / cfg 1
- 分辨率:1280×704(720p)或 832×480
- FPS:24
- 历史记录:每分段保留 18 个潜在帧
- 来源:ComfyUI-Hy-Nomas · Tencent Hy-Nomas