Skip to content

Commit 295c473

Browse files
authored
[Misc] Raise error when using encoder/decoder model with cpu backend (#8355)
1 parent 1bf2dd9 commit 295c473

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

vllm/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
"currently supported with encoder/"
8383
"decoder models.")
8484

85+
STR_NOT_IMPL_ENC_DEC_CPU = ("CPU is not currently supported with "
86+
"encoder/decoder models.")
87+
8588
# Efficiently import all enc/dec error strings
8689
# rather than having to import all of the above
8790
STR_NOT_IMPL_ENC_DEC_ERR_STRS = {
@@ -97,6 +100,7 @@
97100
"STR_NOT_IMPL_ENC_DEC_CUDA_GRAPH": STR_NOT_IMPL_ENC_DEC_CUDAGRAPH,
98101
"STR_NOT_IMPL_ENC_DEC_BACKEND": STR_NOT_IMPL_ENC_DEC_BACKEND,
99102
"STR_NOT_IMPL_ENC_DEC_PROMPT_ADAPTER": STR_NOT_IMPL_ENC_DEC_PROMPT_ADAPTER,
103+
"STR_NOT_IMPL_ENC_DEC_CPU": STR_NOT_IMPL_ENC_DEC_CPU
100104
}
101105

102106
# Constants related to forcing the attention backend selection

vllm/worker/cpu_model_runner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from vllm.multimodal import (MULTIMODAL_REGISTRY, BatchedTensorInputs,
1616
MultiModalInputs)
1717
from vllm.sequence import IntermediateTensors, SequenceGroupMetadata
18-
from vllm.utils import make_tensor_with_pad
18+
from vllm.utils import STR_NOT_IMPL_ENC_DEC_ERR_STRS, make_tensor_with_pad
1919
from vllm.worker.model_runner_base import (
2020
ModelRunnerBase, ModelRunnerInputBase,
2121
_add_attn_metadata_broadcastable_dict,
@@ -121,6 +121,10 @@ def __init__(
121121
# Lazy initialization.
122122
self.model: nn.Module # Set after init_Model
123123

124+
if self.model_config.is_encoder_decoder_model:
125+
raise NotImplementedError(
126+
STR_NOT_IMPL_ENC_DEC_ERR_STRS['STR_NOT_IMPL_ENC_DEC_CPU'])
127+
124128
def load_model(self) -> None:
125129
self.model = get_model(model_config=self.model_config,
126130
load_config=self.load_config,

0 commit comments

Comments
 (0)