ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

vLLM-Omni 运行 Helios 文生视频:三变体离线推理完整指南

vLLM-Omni 运行 Helios 文生视频:三变体离线推理完整指南 vLLM-Omni 运行 Helios 文生视频三变体离线推理完整指南【免费下载链接】vllm-omniA framework for efficient model inference with omni-modality models项目地址: https://gitcode.com/GitHub_Trending/vl/vllm-omni导读Helios 是一个支持文本 / 图像 / 视频到视频生成的开源扩散模型家族本指南聚焦于如何在 vLLM-Omni 中通过共享的text_to_video.py离线示例脚本运行其三个官方检查点Base / Mid / Distilled。读完本文你将掌握 Helios-Base 在单卡 NVIDIA H20 上的基线运行命令、cache-dit 加速用法、Helios-Mid 与 Helios-Distilled 的金字塔式采样与 CFG-Zero* 专属参数配置以及这些行为背后的 pipeline 与调度器实现原理。Helios 是什么模型家族与三种检查点Helios 由 PKU-YuanGroup 提出是一个多模态文本 / 图像 / 视频 → 视频生成模型在 vLLM-Omni 中以完整的HeliosPipeline形式集成支持文本到视频T2V、图像到视频I2V与视频到视频V2V三种条件输入。官方发布了三个可用的检查点仓库recipes/Helios/Helios.md即围绕它们展开检查点特点推荐 guidance scaleBestWishYsh/Helios-Base仅 Stage 1 单阶段去噪基线能力5.0BestWishYsh/Helios-Mid启用 Stage 2 金字塔式多阶段去噪 CFG-Zero*5.0BestWishYsh/Helios-Distilled启用 Stage 2 DMD 蒸馏极少量步数1.0本 recipe 的定位是当你需要在 vLLM-Omni 上获得一个开箱即用、已知可用的 Helios 文生视频起点时直接照抄下文命令即可。文中具体命令以Helios-Base在单张 NVIDIA H20上的 T2V 生成为主Helios-Mid与Helios-Distilled通过共享脚本的通用--extra-bodyJSON 参数驱动见下文专属配置节。需要说明的边界Helios 的图像到视频I2V与视频到视频V2V需要图像 / 视频条件张量作为输入无法通过 JSON 形式的--extra-body传入因此不在text_to_video.py文本到视频示例的覆盖范围内本 recipe 同样不展开。硬件与软件环境基线recipe 中记录的验证环境如下作为复现基线OSUbuntu Linux x86_64Python3.12.12Driver / runtimeNVIDIA driver580.126.20CUDA13.0Hardware1 张 NVIDIA H20 GPU来自 8×H20 主机vLLM 版本0.19.0vLLM-Omni 版本 / commita3903810与大多数离线示例一样该 recipe不需要独立的 deploy 配置 YAML——共享的text_to_video.py通过命令行参数直接构造 pipeline 配置。这一点与在线部署如vllm_omni/deploy/下的 YAML不同适合快速验证与实验。第一步运行 Helios-Base 基线文生视频在仓库根目录下进入共享示例目录并执行cd examples/offline_inference/text_to_video python text_to_video.py \ --model BestWishYsh/Helios-Base \ --prompt A dynamic time-lapse video showing the rapidly moving scenery from the window of a speeding train. \ --guidance-scale 5.0 \ --output helios_t2v_base.mp4脚本会自动识别模型名中包含helios命中_MODEL_PRESETS[helios]预设见 text_to_video.py从而自动填入分辨率384×640帧数99推理步数50guidance scale5.0输出帧率16 fps默认输出文件名helios_output.mp4因此上面显式传入的--guidance-scale 5.0与预设一致--output用于自定义输出路径。显式传入的 CLI 参数优先于预设值——脚本逻辑是仅当某参数未显式给出时才用预设填充text_to_video.py。验证运行结果脚本启动后会打印解析得到的生成配置模型、推理步数、帧数、并行配置、视频尺寸生成结束输出Total generation time: seconds seconds (milliseconds ms) Saved generated video to helios_t2v_base.mp4其中Total generation time为time.perf_counter()测量的端到端耗时text_to_video.py若 worker 上报了峰值显存还会额外打印Worker peak GPU memory (reserved)信息。看到上述两行即代表生成成功视频已通过diffusers.utils.export_to_video写盘。第二步启用 cache-dit 加速如果你的 vLLM-Omni 检出版本包含 Helios 的 cache-dit 支持可以通过--cache-backend开启缓存加速路径并配合--enable-cache-dit-summary在每次扩散前向传播后打印 cache-dit 摘要信息cd examples/offline_inference/text_to_video python text_to_video.py \ --cache-backend cache_dit \ --enable-cache-dit-summary \ --model BestWishYsh/Helios-Base \ --prompt A dynamic time-lapse video showing the rapidly moving scenery from the window of a speeding train. \ --guidance-scale 5.0 \ --output helios_t2v_base.mp4脚本中 cache-dit 的默认缓存配置在检测到--cache-backend cache_dit时构建text_to_video.py关键默认值如下参数默认值含义Fn_compute_blocks1每阶段前向计算块数Bn_compute_blocks0每阶段缓存块数max_warmup_steps4最大预热步数max_cached_steps20最大缓存步数residual_diff_threshold0.24残差差异阈值决定何时可跳过计算max_continuous_cached_steps3最大连续缓存步数enable_taylorseerFalse是否启用 Taylorseer 预估taylorseer_order1Taylorseer 阶数scm_steps_policydynamicSCM 步数策略开启后cache_backend与cache_config会一并传入Omni引擎text_to_video.py用于后续扩散前向时跳过冗余计算。Helios-Mid 与 Helios-Distilled专属--extra-body配置Helios 的模型专属旋钮统一声明在 vllm_omni/model_extras/helios.py 的HELIOS_EXTRA_BODY_PARAMS中通过共享脚本的通用--extra-bodyJSON 参数传递而不是为每个模型定制专属命令行参数。请求中的extra_body字段会被路由进OmniDiffusionSamplingParams.extra_args再被HeliosPipeline消费pipeline_helios.py未声明未知的 key 会被过滤丢弃。Helios-MidStage 2 金字塔 CFG-Zero*python text_to_video.py \ --model BestWishYsh/Helios-Mid \ --prompt A dynamic time-lapse video showing the rapidly moving scenery from the window of a speeding train. \ --guidance-scale 5.0 \ --extra-body {is_enable_stage2: true, pyramid_num_inference_steps_list: [20, 20, 20], use_cfg_zero_star: true, use_zero_init: true, zero_steps: 1} \ --output helios_t2v_mid.mp4参数含义与源码一一对应is_enable_stage2开启 Stage 2 金字塔式多阶段去噪。关闭时只走 Stage 1 单阶段路径对应 Base。pyramid_num_inference_steps_list[20, 20, 20]表示金字塔 3 个阶段pyramid_num_stages默认 3各自的推理步数。源码默认值为[10, 10, 10]。use_cfg_zero_star/use_zero_init/zero_stepsCFG-Zero* 控制。开启后在前zero_steps步默认 1用零初始化输出并利用optimized_scale计算正负条件预测的最优缩放系数alpha_cfg替代传统uncond scale * (pred - uncond)的启发式 CFG 组合pipeline_helios.py。Helios-DistilledStage 2 金字塔 DMD 少步数python text_to_video.py \ --model BestWishYsh/Helios-Distilled \ --prompt A dynamic time-lapse video showing the rapidly moving scenery from the window of a speeding train. \ --num-frames 240 \ --guidance-scale 1.0 \ --extra-body {is_enable_stage2: true, pyramid_num_inference_steps_list: [2, 2, 2], is_amplify_first_chunk: true} \ --output helios_t2v_distilled.mp4参数含义guidance-scale 1.0蒸馏模型建议使用 CFG scale 1.0即基本关闭分类器自由引导。pipeline 中do_classifier_free_guidance仅当guidance_scale 1.0时才为真pipeline_helios.py。pyramid_num_inference_steps_list[2, 2, 2]每个金字塔阶段仅 2 步体现 DMD 蒸馏后的少步数能力。调度器类型由检查点的scheduler_config.json决定scheduler_type dmd时 pipeline 判定为蒸馏模型self.is_distilledpipeline_helios.py调度步进时传入dmd_noisy_tensor/dmd_sigmas/dmd_timesteps执行 DMD 蒸馏采样pipeline_helios.py。is_amplify_first_chunk放大第一个 chunk 的采样强度。源码中该标志生效时蒸馏模型第一个 chunk 的每个阶段步数会翻倍num_steps * 2pipeline_helios.py用于提升首块质量。--num-frames 240来自 text_to_video.md 中 Helios-Distilled 的示例可结合下文 33 帧分块规则理解240 会被向上取整到最接近的 33 的倍数264即 8 个 chunk。关键命令行参数速查下表汇总了运行 Helios 时最常用的参数完整列表见 text_to_video.py 的parse_args参数作用Helios 相关建议--modelDiffusers 模型 ID 或本地路径BestWishYsh/Helios-Base/Mid/Distilled--model-class-name显式覆盖 pipeline 类名本地路径不含helios时可显式指定--prompt文本提示词描述性长句效果更佳--negative-prompt负提示词默认模型特定未提供则为空串--height / --width输出分辨率预设 384×640pipeline 内部会向下取整到 16 的倍数--num-frames帧数建议为 33 的倍数见限制节--num-inference-steps采样步数Base 预设 50--guidance-scaleCFG 强度Base/Mid 用 5.0Distilled 用 1.0--fps输出视频帧率预设 16--output输出 mp4 路径默认helios_output.mp4--extra-body模型专属旋钮 JSON见上文三个变体示例--cache-backend缓存后端目前可选cache_dit--enable-cache-dit-summary打印 cache-dit 摘要与--cache-backend配合使用--seed随机种子默认 42--enforce-eager关闭 torch.compile排查编译问题时使用--enable-cpu-offload/--enable-layerwise-offload显存优化OOM 时尝试--vae-use-slicing/--vae-use-tilingVAE 显存优化OOM 时尝试--quantization量化方式如fp8降低显存占用源码层面HeliosPipeline 是如何工作的组件结构Helios 在 vLLM-Omni 中的实现位于vllm_omni/diffusion/models/helios/目录包含三部分pipeline_helios.pyHeliosPipeline主类继承nn.Module并混入CFGParallelMixinCFG 并行、ProgressBarMixin、DiffusionPipelineProfilerMixin、InteractionMixin、SupportsComponentDiscoveryhelios_transformer.pyHeliosTransformer3DModel3D 扩散 Transformer 主干按检查点transformer/config.json动态构建scheduling_helios.pyHeliosScheduler调度器支持 UniPC / DMD 等scheduler_type与多阶段 sigma 分配。模型加载方面文本编码器为UMT5EncoderModel子目录text_encoderVAE 为AutoencoderKLWan子目录vae以 float32 加载Transformer 与调度器分别读取transformer/config.json与scheduler/scheduler_config.json的配置。pipeline 注册于 vllm_omni/diffusion/registry.py与get_helios_post_process_func/get_helios_pre_process_func关联。值得注意的一个实现细节Helios 检查点的embed_tokens仅以shared.weight形式存储但发布配置中tie_word_embeddingsFalse会导致encoder.embed_tokens.weight保持全零、提示词编码被静默破坏、产出灰色无意义视频。pipeline 在加载时强制tie_word_embeddings True修复了这一点pipeline_helios.py——如果你脱离 vLLM-Omni 自行加载该模型需要留意同样的问题。分块生成与多尺度记忆上下文Helios 采用分块chunked生成策略每个 chunk 生成num_latent_frames_per_chunk默认 9个潜空间帧窗口大小window_num_frames (9 - 1) * 4 1 33时间维 VAE 缩放因子为 4这正是33 帧一个 chunk的由来pipeline_helios.py。生成过程中已生成的帧会以**多尺度历史上下文multi-term memory**形式缓存——默认history_sizes [16, 2, 1]分别对应 long / mid / short 三个尺度的历史潜变量通过索引切分后与当前 chunk 的 hidden states 一同送入 Transformerpipeline_helios.py。chunk 间的历史滚动、首帧保留keep_first_frame、I2V 图像潜变量前缀等逻辑均由prepare_next_chunk/post_decode处理。分布式场景下历史 token 与当前 token 的序列切分逻辑由HeliosTransformer3DModel._sp_split_seq实现并有对应的单测覆盖test_helios_usp_shard.py。两阶段采样Stage 1 与金字塔 Stage 2Stage 1Base 路径单阶段去噪调度器按num_steps 1个 sigma 线性分布0.999 → 0.0构建时间步并按图像序列长度计算动态 shiftcalculate_shiftbase 256 / max 4096shift 0.5 → 1.15。Stage 2Mid / Distilled 路径金字塔式多阶段去噪。每个阶段开始时将潜变量双线性下采样一半乘以 2 补偿缩放按pyramid_num_stages默认 3逐阶段从粗到细去噪阶段间用nearest上采样回原分辨率并按gamma参数计算重加噪的 alpha / beta 系数pipeline_helios.py。每阶段步数由pyramid_num_inference_steps_list控制且各阶段的 sigma 区间由调度器的stage_range默认[0, 1/3, 2/3, 1]划分scheduling_helios.py。显存与资源pipeline 在推理结束后会调用平台层empty_cache()释放显存pipeline_helios.py。在 H20 上如遇显存压力可叠加--vae-use-tiling/--vae-use-slicing或层级卸载参数H20 的 96GB 显存通常足以承载默认 384×640 分辨率配置。已知限制33 帧分块Helios 以 33 帧为 chunk 进行生成。为获得最佳性能建议将--num-frames设置为 33 的倍数非倍数会被向上取整到最近的 33 的倍数例如 99 3 个 chunk240 取整为 264 8 个 chunk。I2V / V2V 不在本文范围需要图像 / 视频条件张量无法通过 JSON--extra-body传递不属于text_to_video.py示例覆盖的任务。batch 限制Helios 的分步执行路径仅支持单请求不支持批量 prompt源码中会显式抛错见 pipeline_helios.py。进阶阅读共享示例的完整文档支持模型列表、全部参数说明、其他模型用法text_to_video.md示例脚本源码预设表、cache-dit 配置、参数解析与导出逻辑text_to_video.pyHelios 模型专属参数声明vllm_omni/model_extras/helios.pyHelios pipeline 完整实现pipeline_helios.pyHelios 调度器实现scheduling_helios.py分布式序列切分的单测验证test_helios_usp_shard.py、test_helios_usp_2rank.py如需将 Helios 接入在线服务或尝试更多 diffusion 能力CFG 并行、TP、CPU 卸载等可参考 diffusion 用户指南 与 离线推理示例总览。【免费下载链接】vllm-omniA framework for efficient model inference with omni-modality models项目地址: https://gitcode.com/GitHub_Trending/vl/vllm-omni创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表