Skip to content

Commit

Permalink
load punica wrapper obj dynamically
Browse files Browse the repository at this point in the history
Signed-off-by: Shanshan Shen <[email protected]>
  • Loading branch information
shen-shanshan committed Jan 13, 2025
1 parent 5cc41a1 commit ac7acb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
7 changes: 2 additions & 5 deletions vllm/platforms/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import vllm._C # noqa
import vllm.envs as envs
from vllm.logger import init_logger
from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase
from vllm.lora.punica_wrapper.punica_gpu import PunicaWrapperGPU

from .interface import DeviceCapability, Platform, PlatformEnum, _Backend

Expand Down Expand Up @@ -219,9 +217,8 @@ def get_attn_backend_cls(cls, selected_backend, head_size, dtype,
return "vllm.attention.backends.flash_attn.FlashAttentionBackend"

@classmethod
def get_punica_wrapper(cls, *args, **kwargs) -> PunicaWrapperBase:
logger.info_once("Using PunicaWrapperGPU.")
return PunicaWrapperGPU(*args, **kwargs)
def get_punica_wrapper(cls) -> str:
return "vllm.lora.punica_wrapper.punica_gpu.PunicaWrapperGPU"


# NVML utils
Expand Down
7 changes: 2 additions & 5 deletions vllm/platforms/hpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import torch

from vllm.logger import init_logger
from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase
from vllm.lora.punica_wrapper.punica_hpu import PunicaWrapperHPU

from .interface import Platform, PlatformEnum, _Backend

Expand Down Expand Up @@ -65,6 +63,5 @@ def is_pin_memory_available(cls):
return False

@classmethod
def get_punica_wrapper(cls, *args, **kwargs) -> PunicaWrapperBase:
logger.info_once("Using PunicaWrapperHPU.")
return PunicaWrapperHPU(*args, **kwargs)
def get_punica_wrapper(cls) -> str:
return "vllm.lora.punica_wrapper.punica_hpu.PunicaWrapperHPU"
3 changes: 1 addition & 2 deletions vllm/platforms/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import torch

from vllm.logger import init_logger
from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase

if TYPE_CHECKING:
from vllm.config import VllmConfig
Expand Down Expand Up @@ -264,7 +263,7 @@ def is_pin_memory_available(cls) -> bool:
return True

@classmethod
def get_punica_wrapper(cls, *args, **kwargs) -> PunicaWrapperBase:
def get_punica_wrapper(cls) -> str:
"""
Return the punica wrapper for current platform.
"""
Expand Down
7 changes: 2 additions & 5 deletions vllm/platforms/rocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import vllm.envs as envs
from vllm.logger import init_logger
from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase
from vllm.lora.punica_wrapper.punica_gpu import PunicaWrapperGPU

from .interface import DeviceCapability, Platform, PlatformEnum, _Backend

Expand Down Expand Up @@ -153,6 +151,5 @@ def verify_quantization(cls, quant: str) -> None:
envs.VLLM_USE_TRITON_AWQ = True

@classmethod
def get_punica_wrapper(cls, *args, **kwargs) -> PunicaWrapperBase:
logger.info_once("Using PunicaWrapperGPU.")
return PunicaWrapperGPU(*args, **kwargs)
def get_punica_wrapper(cls) -> str:
return "vllm.lora.punica_wrapper.punica_gpu.PunicaWrapperGPU"

0 comments on commit ac7acb4

Please sign in to comment.