Skip to content

Commit 99f89d4

Browse files
committed
Prevent add_special_tokens overwrite for BART
Signed-off-by: Carles Onielfa <carlesonielfa@gmail.com>
1 parent 5265385 commit 99f89d4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

vllm_bart_plugin/bart.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,9 @@ def _call_hf_processor(
10411041
has_encoder_data = mm_data is not None and "texts" in mm_data
10421042
result = {}
10431043

1044+
# vLLM may pass add_special_tokens in tok_kwargs; we set it ourselves
1045+
tok_kwargs = {k: v for k, v in tok_kwargs.items() if k != "add_special_tokens"}
1046+
10441047
if has_encoder_data:
10451048
# Tokenize the encoder text from mm_data
10461049
encoder_texts = mm_data["texts"]
@@ -1379,4 +1382,4 @@ def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
13791382
for key in self.keys_to_ignore_on_load_missing:
13801383
loaded_params.add(key)
13811384

1382-
return loaded_params
1385+
return loaded_params

0 commit comments

Comments
 (0)