[Diffusion][Model] Add direct FastH3 8-Step V2 checkpoint loading (#7610)

Signed-off-by: david6666666 <530634352@qq.com>
This commit is contained in:
WeiQing Chen authored and GitHub committed 2026-09-17 08:41:52 +00:00
1 parent 8c3d3407d1
commit cb439f3e84
11 files changed
+1053 -14

No files matched your search

@@ -1,10 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""MiniMax H3 checkpoint resolution for the AR text-encoder stage."""
from pathlib import Path
from vllm_omni.diffusion.utils.hf_utils import get_diffusion_model_index
from vllm_omni.model_executor.model_loader.weight_utils import (
download_weights_from_hf_specific,
)
_FASTH3_MODULAR_MODEL_PREFIX = "FastVideo/"
MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS = {
partition: [
f"{subdir}/text_encoder/**",
@@ -16,6 +22,22 @@ MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS = {
MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS["combined"] = MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS["fl2va"]
def is_minimax_h3_modular(model: str, revision: str | None = None) -> bool:
path = Path(model)
if path.is_dir():
# Native MiniMax-H3 snapshots can advertise the Diffusers modular
# class in ``model_index.json`` while retaining the legacy FL2VA /
# Ref2VA layout. FastH3 modular releases carry this marker file.
return (path / "modular_model_index.json").is_file() or (path / "fastvideo_inference.json").is_file()
# The FastVideo release is the modular checkpoint handled by this
# resolver. Do not classify the native MiniMax-H3 Hub repository from
# its class name alone; its partition files are still required here.
if not model.startswith(_FASTH3_MODULAR_MODEL_PREFIX):
return False
index = get_diffusion_model_index(model, revision=revision) or {}
return index.get("_class_name") == "MiniMaxH3ModularPipeline"
def resolve_minimax_h3_partition(
model: str,
task_type: str | None,
@@ -42,10 +64,13 @@ def resolve_minimax_h3_encoder_model_root(
) -> str:
path = Path(model)
partition = resolve_minimax_h3_partition(model, task_type, auto_partition="fl2va")
modular = is_minimax_h3_modular(model, revision)
if path.is_dir():
if path.name == "text_encoder" and (path / "config.json").is_file():
return str(path)
if modular:
return str(path / "text_encoder")
if path.name in {"FL2VA", "Ref2VA"}:
path = path.parent
subdir = "Ref2VA" if partition == "ref2va" else "FL2VA"
@@ -53,11 +78,13 @@ def resolve_minimax_h3_encoder_model_root(
snapshot = download_weights_from_hf_specific(
model_name_or_path=model,
cache_dir=None,
allow_patterns=MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS[partition],
allow_patterns=["text_encoder/**"] if modular else MINIMAX_H3_ENCODER_DOWNLOAD_PATTERNS[partition],
revision=revision,
require_all=True,
)
if modular:
return str(Path(snapshot) / "text_encoder")
subdir = "Ref2VA" if partition == "ref2va" else "FL2VA"
return str(Path(snapshot) / subdir / "text_encoder")