27 lines
744 B
Python
27 lines
744 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from .interface import Platform, PlatformEnum
|
|
|
|
if TYPE_CHECKING:
|
|
from vllm.config import VllmConfig
|
|
else:
|
|
VllmConfig = None
|
|
|
|
|
|
class NeuronPlatform(Platform):
|
|
_enum = PlatformEnum.NEURON
|
|
device_name: str = "neuron"
|
|
device_type: str = "neuron"
|
|
supported_quantization: list[str] = ["neuron_quant"]
|
|
|
|
@classmethod
|
|
def get_device_name(cls, device_id: int = 0) -> str:
|
|
return "neuron"
|
|
|
|
@classmethod
|
|
def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
|
|
parallel_config = vllm_config.parallel_config
|
|
if parallel_config.worker_cls == "auto":
|
|
parallel_config.worker_cls = \
|
|
"vllm.worker.neuron_worker.NeuronWorker"
|