[Bugfix] Gate Kimi-K3 KDA warmup on sys.modules to skip Kimi import for non-Kimi models (#59257)
Signed-off-by: YueshenZ <YueshenZ@users.noreply.github.com> Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: YueshenZ <YueshenZ@users.noreply.github.com> Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: zjy0516 <riverclouds.zhu@qq.com>
This commit is contained in:
co-authored by
YueshenZ
Claude Code
Codex
zjy0516
parent
bcee730b1a
commit
08d77cad7b
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@@ -19,7 +20,10 @@ logger = init_logger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def _get_kda_layer(worker: Worker) -> KimiK3DeltaAttention | None:
|
def _get_kda_layer(worker: Worker) -> KimiK3DeltaAttention | None:
|
||||||
from vllm.models.kimi_k3.nvidia.kda import KimiK3DeltaAttention
|
# Kimi model construction already imports kda. Avoid importing it here.
|
||||||
|
kda = sys.modules.get("vllm.models.kimi_k3.nvidia.kda")
|
||||||
|
if kda is None:
|
||||||
|
return None
|
||||||
|
|
||||||
compilation_config = getattr(
|
compilation_config = getattr(
|
||||||
worker.model_runner,
|
worker.model_runner,
|
||||||
@@ -33,7 +37,7 @@ def _get_kda_layer(worker: Worker) -> KimiK3DeltaAttention | None:
|
|||||||
(
|
(
|
||||||
layer
|
layer
|
||||||
for layer in static_context.values()
|
for layer in static_context.values()
|
||||||
if isinstance(layer, KimiK3DeltaAttention)
|
if isinstance(layer, kda.KimiK3DeltaAttention)
|
||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user