
vLLM-Omni 原生推理 LingBot-VideoDense 与 MoE 文生视频的离线生成与在线服务实战【免费下载链接】vllm-omniA framework for efficient model inference with omni-modality models项目地址: https://gitcode.com/GitHub_Trending/vl/vllm-omni本指南介绍如何在 vLLM-Omni 中通过原生 diffusion pipeline 运行 Robbyant 的 LingBot-Video 系列文生视频T2V模型覆盖robbyant/lingbot-video-dense-1.3bDense与robbyant/lingbot-video-moe-30b-a3bMoE30B 总参数 / 3B 激活两种 checkpoint 的离线推理与 OpenAI 兼容/v1/videos在线服务。读完本文你将掌握完整可复制的命令行、关键采样参数约束分辨率 / 帧数 / CFG / flow-shift并理解原生 MoE 路由实现与上游官方实现 bitwise 数值一致性的验证方法。概览LingBot-Video 与 vLLM-Omni 的原生集成厂商VendorRobbyant模型Modelsrobbyant/lingbot-video-dense-1.3b与robbyant/lingbot-video-moe-30b-a3b任务TaskText-to-video文生视频运行模式Mode离线生成以及基于 OpenAI 兼容/v1/videosAPI 的在线服务维护方MaintainerCommunity与需要额外安装上游lingbot_videoPython 包的方案不同vLLM-Omni 的运行时路径不导入上游lingbot_video包而是直接用仓库内实现的LingBotVideoPipeline加载 checkpoint 的各个组件Dense 或 routed-MoE 的 DiT 主干、共享的FlowUniPCMultistepScheduler调度器、Qwen3-VL 文本编码器与 Wan VAE。核心实现位于 pipeline_lingbot_video.py 与 lingbot_video_transformer.py。本次首次 MoE 集成刻意限定为文生视频、单 GPU目标是基础 BF16 checkpoint不加载可选的 refiner 及额外并行、缓存、量化或专家 kernel 后端。何时使用本配方当你想在 vLLM-Omni 的原生 pipeline 中运行 Dense 或 MoE 的 LingBot-Video checkpoint 时使用本配方即可。它的离线命令、在线服务参数、数值一致性校验脚本均为该模型族量身定制并已在仓库测试中覆盖在线服务冒烟测试test_lingbot_video_moe.py、test_lingbot_video.py模型级 CUDA 与 Transformer 测试test_lingbot_video_moe_cuda.py、test_lingbot_video_transformer.pyPipeline 行为测试test_pipeline_lingbot_video.py硬件支持与显存要求本配方记录的路径是CUDA 单 GPU 上的 Dense 与 BF16 MoE checkpoint。多 GPU 并行、Cache-DiT、量化与 CPU offload 在当前集成中未针对 LingBot-Video 验证。1 x NVIDIA L20X 实测参考两个 checkpoint 均已在单张 NVIDIA L20X 上以192x320、9 帧、2 步的规格完成冒烟测试。需要注意MoE 冒烟测试约预留 67.70 GiB 显存约 70 GiB因此小验证形状也需要配备至少约 70 GiB 可用显存的 GPU更大的分辨率、帧数或并发请求需要额外显存余量MoE 路径使用 BF16 专家权重验证。离线文生视频推理离线推理统一使用仓库共享的 T2V 示例脚本 text_to_video.py。该脚本内置了按模型名自动匹配的预设_MODEL_PRESETS其中lingbot预设即对应LingBotVideoPipeline、192x320、9 帧、2 步、guidance_scale3.0、flow_shift3.0、24fps——与下方显式传参的等价。Dense 离线 T2VCUDA_VISIBLE_DEVICES0 \ python examples/offline_inference/text_to_video/text_to_video.py \ --model robbyant/lingbot-video-dense-1.3b \ --prompt a robotic arm picks up a red block \ --output lingbot_t2v.mp4 \ --height 192 \ --width 320 \ --num-frames 9 \ --num-inference-steps 2 \ --guidance-scale 3.0 \ --flow-shift 3.0 \ --seed 42 \ --fps 24MoE 离线 T2VCUDA_VISIBLE_DEVICES0 \ python examples/offline_inference/text_to_video/text_to_video.py \ --model robbyant/lingbot-video-moe-30b-a3b \ --prompt a robotic arm picks up a red block \ --output lingbot_moe_t2v.mp4 \ --height 192 \ --width 320 \ --num-frames 9 \ --num-inference-steps 2 \ --guidance-scale 3.0 \ --flow-shift 3.0 \ --seed 42 \ --fps 24脚本运行后会打印生成耗时并在 worker 侧报告峰值预留显存如Worker peak GPU memory (reserved): ... MiB便于快速核对资源占用。离线脚本参数速查与 LingBot 相关参数说明--modelDiffusers 模型 ID 或本地路径--model-class-name覆盖模型类名LingBot 对应LingBotVideoPipeline也可不传由模型名自动解析--prompt/--negative-prompt正/负提示词负提示词缺省时使用 pipeline 内置默认值--height/--width输出分辨率必须是 16 的倍数--num-frames帧数必须为 1 或4n1--num-inference-steps采样步数质量扫描时适当增大--guidance-scaleCFG 系数--flow-shift调度器 flow-shift 值--seed随机种子用于可复现--fps输出 MP4 帧率在线服务OpenAI 兼容 /v1/videos在线模式下每个服务实例在启动时通过vllm serve model --omni指定单一模型。完整 API 契约端点、字段、任务状态与存储见 videos_api.md。启动 Dense 服务CUDA_VISIBLE_DEVICES0 \ vllm serve robbyant/lingbot-video-dense-1.3b \ --omni \ --model-class-name LingBotVideoPipeline \ --default-sampling-params \ {0:{num_frames:81,num_inference_steps:40,guidance_scale:6.0}} \ --port 8091启动 MoE 服务MoE checkpoint 使用同一套单 GPU pipeline 启动CUDA_VISIBLE_DEVICES0 \ vllm serve robbyant/lingbot-video-moe-30b-a3b \ --omni \ --model-class-name LingBotVideoPipeline \ --default-sampling-params \ {0:{num_frames:81,num_inference_steps:40,guidance_scale:6.0}} \ --port 8091上述 stage 默认值与 LingBot 参考 pipeline 一致请求级参数继续覆盖这些默认值因此下方较小的冒烟请求不受影响。服务 MoE 时只需把请求表单里的model值替换为robbyant/lingbot-video-moe-30b-a3b。提交文生视频任务并轮询下载create_response$(curl -s http://localhost:8091/v1/videos \ -F modelrobbyant/lingbot-video-dense-1.3b \ -F prompta robotic arm picks up a red block \ -F width320 \ -F height192 \ -F num_frames9 \ -F fps24 \ -F num_inference_steps2 \ -F guidance_scale3.0 \ -F flow_shift3.0 \ -F seed42) video_id$(echo ${create_response} | jq -r .id) while true; do status$(curl -s http://localhost:8091/v1/videos/${video_id} | jq -r .status) if [ ${status} completed ]; then break fi if [ ${status} failed ]; then curl -s http://localhost:8091/v1/videos/${video_id} | jq . exit 1 fi sleep 2 done curl -L http://localhost:8091/v1/videos/${video_id}/content -o lingbot_t2v.mp4请求表单字段与/v1/videos文档对齐prompt、width/height、num_frames、fps、num_inference_steps、guidance_scale、flow_shift、seed均为multipart/form-data字段任务先进入queued被调度器选中后变为in_progress完成后可通过/v1/videos/{video_id}/content下载 MP4。关键参数解析参数建议冒烟值说明height192必须是 16 的倍数width320必须是 16 的倍数num_frames9必须为1或4n 1本次集成以视频输出验证 T2Vnum_inference_steps2质量扫描时使用更多步数guidance_scale3.0当该值大于1.0时 CFG 生效flow_shift3.0调度器 flow-shift是 pipeline 内部shift参数的别名negative_prompt模型默认可选的、描述需规避伪影的文本fps24输出 MP4 帧率参数背后的源码级约束这些限制并非文档约定而是 pipeline 内硬性校验见 pipeline_lingbot_video.pycheck_inputs(height, width, num_frames)会直接抛出ValueErrornum_frames必须为 1 或满足(num_frames - 1) % 4 0height/width必须能被 16 整除。根因是 Wan VAE 的时间维下采样因子为 4vae_scale_factor_temporal 4、空间维下采样因子为 8vae_scale_factor_spatial 8latent 形状由(num_frames - 1) // 4 1与height // 8、width // 8计算。CFG 生效条件do_cfg guidance_scale 1.0与上表注释一致。CFG 分支支持batch_cfg正负条件拼接进同一 batch 推理与null_cond_clone_zero负条件用零填充两种模式均可通过extra_params/extra_body控制。flow_shift别名shiftpipeline 的_generate签名中参数名为shift默认3.0引擎层flow_shift经 model_extras/lingbot_video.py 声明的LINGBOT_VIDEO_EXTRA_BODY_PARAMS集合含flow_shift、shift、resolution、ratio、duration、t_thresh、refiner_sigma_tail_steps等映射进采样参数再以default_shift传入调度器的set_timesteps(..., shiftshift)。服务端--default-sampling-params中的0指 rank 0 / 唯一 stagestage 默认值先于请求级参数生效请求级字段可覆盖。运行时组件与加载方式从源码结构看LingBotVideoPipeline继承nn.Module并实现SupportImageInput、ProgressBarMixin、SupportsComponentDiscovery在__init__阶段直接从模型仓库各 subfolder 加载组件权重不走load_weights流式路径DiT 主干LingBotVideoTransformer3DModel.from_pretrained(model, subfoldertransformer)默认 dtype 为 BF16文本编码器Qwen3VLForConditionalGenerationsubfoldertext_encoder配合Qwen3VLProcessorsubfolderprocessorVAEAutoencoderKLWansubfoldervae默认 FP32调度器FlowUniPCMultistepSchedulersubfolderscheduler。各组件 subfolder 与 dtype 均可通过model_config的transformer_subfolder、text_encoder_subfolder、vae_subfolder、transformer_dtype、text_encoder_dtype、vae_dtype等字段调整。提示词在送入编码器前会套用内置的PROMPT_TEMPLATE系统级Enhanced prompt增强描述模板解码时 latent 先按 VAE 的latents_mean/latents_std反归一化VAE 输出被 clamp 到[-1, 1]再映射回[0, 1]帧序列。该 pipeline 当前每个 batch 仅支持一个请求forward中对req.num_reqs ! 1直接报错。MoE 实现的源码级要点robbyant/lingbot-video-moe-30b-a3b的 Transformer 主干由 lingbot_video_transformer.py 中的LingBotVideoBlock组成每个 block 按decoder_sparse_step与层索引决定使用LingBotVideoSparseMoeBlock稀疏 MoE还是普通LingBotVideoMLPDense FFN。MoE 路径包含以下关键设计Router 的不对称选路LingBotVideoRouter使用偏差修正分数scores e_score_correction_bias做 top-k 选择而 gating 权重使用原始分数与参考实现一致支持n_group/topk_group的分组受限 top-kgroup-limited top-k与norm_topk_prob概率归一化。分组专家与 scatter restoreLingBotVideoSparseMoeBlock将 token 按专家重排_reorder_tokens在 CUDA 上通过torch._grouped_mm以 BF16 批量执行专家矩阵乘法_run_grouped_experts无torch._grouped_mm时回退到逐专家循环再按路由分数以FP32 scatter 加权还原_restore_tokens中unsorted.float() * scores_unsorted求和padding 掩码在 forward 中作用于路由分数并重新归一化。共享专家n_shared_experts 0时叠加一个LingBotVideoMLP作为 shared expert。FP32 敏感路径LINGBOT_VIDEO_FP32_MODULES明确列出time_embedder、time_modulation、scale_shift_table、各norm*、router等模块保持 FP32should_keep_in_fp32按模块名判断RMSNorm 采用 FP32 累加这与验证记录中Router 权重与修正偏置保持 FP32routed 与 shared 专家权重以 BF16 加载一致。数值一致性验证MoE 对上游 bitwise 对齐仓库提供独立一致性校验脚本 moe_transformer_parity.py对比原生 MoE 实现与本地 check-out 的上游 LingBot-Video 实现。脚本只使用本地文件不下载 checkpoint。先设置上游仓库与缓存 MoE checkpoint 的路径export LINGBOT_VIDEO_REPO/path/to/lingbot-video export LINGBOT_VIDEO_MOE_MODEL/path/to/lingbot-video-moe-30b-a3b轻量稀疏块对比block 范围CUDA_VISIBLE_DEVICES0 \ python benchmarks/lingbot_video/moe_transformer_parity.py \ --scope block \ --official-repo ${LINGBOT_VIDEO_REPO} \ --output-json /tmp/lingbot_moe_block_parity.json该路径覆盖偏差修正后的 router 选择、分组受限 top-k、routed 专家、FP32 scatter 加权还原、padding 掩码与 shared expert。除非上游与原生 block 输出 bitwise 相等否则脚本以非零状态退出。真实 checkpoint 的 Transformer 对比transformer 范围需要一张能容纳 30B checkpoint 的 GPU模型顺序加载同一时刻 GPU 上不会同时驻留两份副本CUDA_VISIBLE_DEVICES0 \ python benchmarks/lingbot_video/moe_transformer_parity.py \ --scope transformer \ --official-repo ${LINGBOT_VIDEO_REPO} \ --model ${LINGBOT_VIDEO_MOE_MODEL} \ --output-json /tmp/lingbot_moe_transformer_parity.jsonTransformer 对比把官方实现固定为diffusers:_native_math、原生实现固定为TORCH_SDPA SDPBackend.MATH。预期结果是exacttrue、output.equaltrue且 max/mean/RMSE 误差为零。注意不同融合 attention kernel 可能在 MoE 路由前引入 BF16 舍入差异因此自动 attention 后端对比仅作诊断参考不是 bitwise 正确性的判定标准。脚本输出 JSON 中还包括形状、cosine 相似度与finite标志等指标。本地验证记录功能性冒烟非生产基准原配方附带的本地验证数据不应视为生产性能基准仅是小验证输入的功能冒烟 受控数值一致性证据Dense 本地冒烟9 帧192x320、2 步请求生成耗时0.2923s峰值预留显存14548 MiB。Dense 对上游 parity harness形状[9, 192, 320, 3]MAE0.0065238、MSE0.00006650、PSNR41.77 dB原生请求耗时0.2875s。MoE 本地验证NVIDIA L20Xcheckpoint revisionf2e538f64afe00cc4ae674db2aeb52e2945edfd5加载全部977个 transformer state keys、共30,084,506,176参数router 权重与修正偏置保持 FP32routed 与 shared 专家权重以 BF16 加载完整 48 层 transformer 前向返回有限值的[1, 16, 1, 8, 8]BF16 输出双方均使用匹配的 math SDPA 后端时完整原生 transformer 与上游逐位一致max_abs0、mean_abs0隔离的稀疏 MoE block覆盖 router、分组专家、scatter restore 与 shared expert同样与上游逐位一致原生 pipeline 以 2 步生成 9 帧192x320MP4峰值预留显存69326 MiB67.70 GiB在线/v1/videos冒烟完成任务的创建、轮询与 MP4 下载1 passed。已知限制仅支持T2V 基础 transformer 推理。T2I、I2V、TI2V 及 checkpoint 可选的refiner/transformer 不在本次集成范围内。首次集成仅验证 BF16 MoE checkpoint。不声明 HSDP、tensor、sequence、expert 或 CFG 并行能力。不声明 Cache-DiT、TeaCache、CPU offload、VAE patch 并行或量化推理。上游项目可选的 Triton、SGLang、FP8 及替代 fused-expert 后端均未包含。每个 LingBot pipeline batch 当前仅支持一个请求含单 batch 单输出限制。【免费下载链接】vllm-omniA framework for efficient model inference with omni-modality models项目地址: https://gitcode.com/GitHub_Trending/vl/vllm-omni创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考