| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | from typing import TYPE_CHECKING |
| 5 | |
| 6 | if TYPE_CHECKING: |
| 7 | from ..config_parser import INCLayerConfig |
| 8 | from .inc_scheme import INCScheme |
| 9 | |
| 10 | |
| 11 | def resolve_scheme(layer_config: "INCLayerConfig") -> "INCScheme": |
| 12 | from .inc_fp8_scheme import INCFp8Scheme |
| 13 | from .inc_mxfp4_scheme import INCMxfp4Scheme |
| 14 | from .inc_mxfp8_scheme import INCMxfp8Scheme |
| 15 | from .inc_wna16_scheme import INCWna16Scheme |
| 16 | |
| 17 | scheme_list: list[type[INCScheme]] = [ |
| 18 | INCFp8Scheme, |
| 19 | INCMxfp8Scheme, |
| 20 | INCWna16Scheme, |
| 21 | INCMxfp4Scheme, |
| 22 | ] |
| 23 | |
| 24 | for scheme_cls in scheme_list: |
| 25 | if scheme_cls.can_handle(layer_config): |
| 26 | return scheme_cls() |
| 27 | |
| 28 | raise NotImplementedError(f"No INC scheme found for layer config: {layer_config}") |