| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | from typing import TYPE_CHECKING |
| 4 | |
| 5 | from vllm.platforms import current_platform |
| 6 | |
| 7 | if TYPE_CHECKING: |
| 8 | if current_platform.is_rocm(): |
| 9 | from .amd.model import ( |
| 10 | InklingForCausalLM, |
| 11 | InklingForConditionalGeneration, |
| 12 | ) |
| 13 | from .amd.mtp import InklingMTP as InklingMTP |
| 14 | else: |
| 15 | from .nvidia.model import ( |
| 16 | InklingForCausalLM, |
| 17 | InklingForConditionalGeneration, |
| 18 | ) |
| 19 | from .nvidia.mtp import InklingMTP as InklingMTP |
| 20 | |
| 21 | __all__ = [ |
| 22 | "InklingForConditionalGeneration", |
| 23 | "InklingForCausalLM", |
| 24 | "InklingMTP", |
| 25 | ] |
| 26 | |
| 27 | |
| 28 | def __getattr__(name: str): |
| 29 | if name == "InklingMTP": |
| 30 | if current_platform.is_rocm(): |
| 31 | from .amd import mtp as amd_mtp |
| 32 | |
| 33 | return amd_mtp.InklingMTP |
| 34 | |
| 35 | from .nvidia import mtp as nvidia_mtp |
| 36 | |
| 37 | return nvidia_mtp.InklingMTP |
| 38 | |
| 39 | if name in __all__: |
| 40 | if current_platform.is_rocm(): |
| 41 | from .amd import model as amd_model |
| 42 | |
| 43 | return getattr(amd_model, name) |
| 44 | |
| 45 | from .nvidia import model as nvidia_model |
| 46 | |
| 47 | return getattr(nvidia_model, name) |
| 48 | |
| 49 | raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |