Skip to content

Commit fcf09f2

Browse files
committed
fix cross_encoding
1 parent 1809308 commit fcf09f2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vllm/model_executor/models/roberta.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
178178
super().__init__()
179179
config = vllm_config.model_config.hf_config
180180

181+
if vllm_config.model_config.task == "score":
182+
# fix cross_encoding. See #19201
183+
padding_idx = getattr(config,
184+
"pad_token_id", 0)
185+
vllm_config.model_config.max_model_len -= padding_idx * 2
186+
181187
self.default_activation_function = \
182188
get_cross_encoder_activation_function(config)
183189

0 commit comments

Comments
 (0)