Skip to content

Commit

Permalink
Use platform to select base worker for MultiStepWorker
Browse files Browse the repository at this point in the history
Signed-off-by: Chendi Xue <[email protected]>
  • Loading branch information
Chendi Xue authored and xuechendi committed Oct 16, 2024
1 parent f04901b commit 6d1abec
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions vllm/spec_decode/multi_step_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,25 @@
SpeculativeProposer)
from vllm.spec_decode.proposer_worker_base import ProposerWorkerBase
from vllm.spec_decode.top1_proposer import Top1Proposer
from vllm.worker.worker import Worker
from vllm.worker.hpu_worker import HPUWorker


class MultiStepWorker(HPUWorker, ProposerWorkerBase):
from vllm.platforms import current_platform
from vllm.utils import is_neuron, is_openvino, is_xpu
if is_neuron():
from vllm.worker.neuron_worker import NeuronWorker as WorkerBaseCls
elif current_platform.is_hpu():
from vllm.worker.hpu_worker import HPUWorker as WorkerBaseCls
elif is_openvino:
from vllm.worker.openvino_worker import OpenVINOWorker as WorkerBaseCls
elif current_platform.is_cpu():
from vllm.worker.cpu_worker import CPUWorker as WorkerBaseCls
elif current_platform.is_tpu():
from vllm.worker.tpu_worker import TPUWorker as WorkerBaseCls
elif is_xpu():
from vllm.worker.xpu_worker import XPUWorker as WorkerBaseCls
else:
from vllm.worker.worker import Worker as WorkerBaseCls


class MultiStepWorker(WorkerBaseCls, ProposerWorkerBase):
"""The MultiStepWorker is equivalent to a Worker except that it allows
multiple forward passes in a single call, assuming the scheduler has
allocated enough space to store the additional KV. This reduces overhead
Expand Down

0 comments on commit 6d1abec

Please sign in to comment.