Skip to content

vllm.models.hy_v4_flash

HYV4 Flash model entry points; configuration imports remain GPU-independent.

NVIDIA and ROCm implementations live in nvidia/ and amd/, with vendor-neutral code in common/; this module dispatches on the current platform.

Modules:

  • amd –
  • common –
  • configs –

    HYV4-compatible configuration for Flash's hybrid attention and Engram.

  • dfly_config –

    Flash target policy for the existing HYV4 DFly draft and weight layout.

  • nvidia –

__getattr__(name)

Load model code only when requested, keeping config-only imports light.

Source code in vllm/models/hy_v4_flash/__init__.py
def __getattr__(name: str) -> Any:
    """Load model code only when requested, keeping config-only imports light."""
    if name not in __all__:
        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
    if name == "HYV4FlashVLForConditionalGeneration":
        module = import_module(".common.vl_model", __name__)
    else:
        module = platform_module("model")
    model_cls = getattr(module, name)
    globals()[name] = model_cls
    return model_cls

platform_module(name)

Import a module from the current platform's subpackage.

Parameters:

  • name

    (str) –

    Module name inside amd/ or nvidia/, e.g. "model".

Returns:

Source code in vllm/models/hy_v4_flash/__init__.py
def platform_module(name: str) -> ModuleType:
    """Import a module from the current platform's subpackage.

    Args:
        name: Module name inside `amd/` or `nvidia/`, e.g. `"model"`.

    Returns:
        The imported module.

    """
    from vllm.platforms import current_platform

    platform = "amd" if current_platform.is_rocm() else "nvidia"
    return import_module(f".{platform}.{name}", __name__)