[New Model] Lance (ByteDance) — unified AR+diffusion multimodal (#3697)

Adds Lance (bytedance-research/Lance), a 3B unified AR+diffusion
multimodal model on a Qwen2.5-VL backbone. Lance is BAGEL-lineage:
it reuses vLLM-Omni's BAGEL Mixture-of-Transformers core verbatim and
specializes only the ViT (Qwen2.5-VL vision), the VAE (Wan2.2) and the
checkpoint layout.

All six single-stage Lance modalities verified end-to-end on 1x B300:
t2i, t2v, image_edit, video_edit, x2t_image (image understanding) and
x2t_video (video understanding). 3-D mRoPE is wired through
BagelRotaryEmbedding for the x2t / video / edit paths. Includes the
upstream gap-analysis quality fixes (task-specific system prompts, full
Qwen chat template, upstream inference defaults and aspect-ratio
buckets).

Ships an offline example (examples/offline_inference/lance/), an
OpenAI-compatible online-serving example
(examples/online_serving/lance/) and an e2e test
(tests/e2e/online_serving/test_lance.py).

See LANCE_PR.md for the architecture rationale, per-modality status and
the two remaining follow-ups (two-stage AR+DiT, video_edit polish).

Closes #3697.

Signed-off-by: lishunyang <lishunyang03@gmail.com>
This commit is contained in:
lishunyang committed 2026-05-18 22:09:14 +00:00
1 parent 309e5c38c6
commit 69bcc6416d
23 files changed
+4292 -6

No files matched your search

+37
View File
@@ -790,6 +790,21 @@ class OmniDiffusionConfig:
self.supports_multimodal_inputs = metadata.supports_multimodal_inputs
self.max_multimodal_image_inputs = metadata.max_multimodal_image_inputs
@staticmethod
def _looks_like_lance_subfolder(model: str | None) -> bool:
"""Return True when ``--model`` points at a Lance per-component subfolder.
Lance's HF repo bundles ``Lance_3B/``, ``Lance_3B_Video/`` and
``Qwen2.5-VL-ViT/`` under a single top-level ``config.json``; users may
reasonably hand the AR-style sub-checkpoint path directly. The
``LancePipeline`` constructor knows to walk up to the repo root from
either subfolder name.
"""
if not model:
return False
base = os.path.basename(str(model).rstrip("/"))
return base in {"Lance_3B", "Lance_3B_Video"}
def enrich_config(self) -> None:
"""Load model metadata from HuggingFace and populate config fields.
@@ -843,6 +858,15 @@ class OmniDiffusionConfig:
else:
cfg = get_hf_file_to_dict("config.json", self.model)
if cfg is None:
# Lance ships its top-level config.json one directory above
# the per-checkpoint subfolders (``Lance_3B/`` or
# ``Lance_3B_Video/``). Try to recover that case before
# raising.
if self._looks_like_lance_subfolder(self.model):
self.model_class_name = "LancePipeline"
self.set_tf_model_config(TransformerConfig())
self.update_multimodal_support()
return
raise ValueError(f"Could not find config.json or model_index.json for model {self.model}")
self.set_tf_model_config(TransformerConfig.from_dict(cfg))
@@ -853,6 +877,19 @@ class OmniDiffusionConfig:
self.model_class_name = "BagelPipeline"
self.set_tf_model_config(TransformerConfig())
self.update_multimodal_support()
elif (
model_type == "lance"
or "LancePipeline" in architectures
or cfg.get("model_name") == "Lance"
or self._looks_like_lance_subfolder(self.model)
):
# Lance ships a non-HF top-level config.json (model_name only)
# plus per-component subfolders; resolve to the Lance pipeline.
# Also accept --model pointing directly at the ``Lance_3B`` or
# ``Lance_3B_Video`` subfolder by walking up to the repo root.
self.model_class_name = "LancePipeline"
self.set_tf_model_config(TransformerConfig())
self.update_multimodal_support()
elif model_type == "neo_chat":
self.model_class_name = "SenseNovaU1Pipeline"
self.tf_model_config = TransformerConfig()