main
py 56 lines 2.23 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 """DeepSeek V4 model — hardware-isolated entry point.
4
5 The actual implementation lives under ``nvidia/`` and ``amd/``; this module
6 picks the right one for the current platform and re-exports the public
7 classes used by the model registry and quantization config lookup.
8 """
9
10 from vllm.platforms import current_platform
11
12 from .quant_config import DeepseekV4FP8Config
13
14 # Pick the per-platform implementation. The NVIDIA branch is the static
15 # default that mypy sees; the ROCm/XPU branches override at runtime and are
16 # kept type-compatible via ``# type: ignore[assignment]``.
17 if current_platform.is_rocm():
18 from .amd.dspark import ( # type: ignore[assignment]
19 DSparkDeepseekV4ForCausalLM,
20 )
21 from .amd.model import DeepseekV4ForCausalLM
22 from .amd.mtp import DeepSeekV4MTP
23 from .common.vl_model import ( # type: ignore[assignment]
24 DeepseekV4ForConditionalGeneration,
25 )
26 elif current_platform.is_xpu():
27 from .vl_stub import ( # type: ignore[assignment]
28 DeepseekV4ForConditionalGeneration,
29 )
30 from .xpu.dspark import DSparkDeepseekV4ForCausalLM # type: ignore[assignment]
31 from .xpu.model import DeepseekV4ForCausalLM # type: ignore[assignment]
32 from .xpu.mtp import DeepSeekV4MTP # type: ignore[assignment]
33 elif current_platform.is_cpu():
34 from .cpu.dspark import DSparkDeepseekV4ForCausalLM # type: ignore[assignment]
35 from .cpu.model import DeepseekV4ForCausalLM # type: ignore[assignment]
36 from .cpu.mtp import DeepSeekV4MTP # type: ignore[assignment]
37 from .vl_stub import ( # type: ignore[assignment]
38 DeepseekV4ForConditionalGeneration,
39 )
40 else:
41 from .common.vl_model import ( # type: ignore[assignment]
42 DeepseekV4ForConditionalGeneration,
43 )
44 from .nvidia.dspark import ( # type: ignore[assignment]
45 DSparkDeepseekV4ForCausalLM,
46 )
47 from .nvidia.model import DeepseekV4ForCausalLM # type: ignore[assignment]
48 from .nvidia.mtp import DeepSeekV4MTP # type: ignore[assignment]
49
50 __all__ = [
51 "DSparkDeepseekV4ForCausalLM",
52 "DeepSeekV4MTP",
53 "DeepseekV4FP8Config",
54 "DeepseekV4ForCausalLM",
55 "DeepseekV4ForConditionalGeneration",
56 ]