mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-06-08 11:55:43 +08:00
treat do_lower_case in the same way as the sentence-transformers library (#11815)
Signed-off-by: Max de Bayser <mbayser@br.ibm.com>
This commit is contained in:
parent
615e4a5401
commit
1fe554bac3
@ -35,6 +35,7 @@ class MockModelConfig:
|
|||||||
logits_processor_pattern = None
|
logits_processor_pattern = None
|
||||||
diff_sampling_param: Optional[dict] = None
|
diff_sampling_param: Optional[dict] = None
|
||||||
allowed_local_media_path: str = ""
|
allowed_local_media_path: str = ""
|
||||||
|
encoder_config = None
|
||||||
|
|
||||||
def get_diff_sampling_param(self):
|
def get_diff_sampling_param(self):
|
||||||
return self.diff_sampling_param or {}
|
return self.diff_sampling_param or {}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ from ..utils import check_embeddings_close
|
|||||||
# [Encoder-only]
|
# [Encoder-only]
|
||||||
pytest.param("BAAI/bge-base-en-v1.5",
|
pytest.param("BAAI/bge-base-en-v1.5",
|
||||||
marks=[pytest.mark.core_model, pytest.mark.cpu_model]),
|
marks=[pytest.mark.core_model, pytest.mark.cpu_model]),
|
||||||
|
pytest.param("sentence-transformers/all-MiniLM-L12-v2"),
|
||||||
pytest.param("intfloat/multilingual-e5-large"),
|
pytest.param("intfloat/multilingual-e5-large"),
|
||||||
# [Encoder-decoder]
|
# [Encoder-decoder]
|
||||||
pytest.param("intfloat/e5-mistral-7b-instruct",
|
pytest.param("intfloat/e5-mistral-7b-instruct",
|
||||||
|
|||||||
@ -160,6 +160,11 @@ class OpenAIServing:
|
|||||||
truncate_prompt_tokens: Optional[Annotated[int, Field(ge=1)]],
|
truncate_prompt_tokens: Optional[Annotated[int, Field(ge=1)]],
|
||||||
add_special_tokens: bool,
|
add_special_tokens: bool,
|
||||||
) -> TextTokensPrompt:
|
) -> TextTokensPrompt:
|
||||||
|
if (self.model_config.encoder_config is not None
|
||||||
|
and self.model_config.encoder_config.get(
|
||||||
|
"do_lower_case", False)):
|
||||||
|
prompt = prompt.lower()
|
||||||
|
|
||||||
if truncate_prompt_tokens is None:
|
if truncate_prompt_tokens is None:
|
||||||
encoded = tokenizer(prompt, add_special_tokens=add_special_tokens)
|
encoded = tokenizer(prompt, add_special_tokens=add_special_tokens)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -190,6 +190,12 @@ class InputPreprocessor:
|
|||||||
# on the task and language of their request. Also needed to avoid
|
# on the task and language of their request. Also needed to avoid
|
||||||
# appending an EOS token to the prompt which disrupts generation.
|
# appending an EOS token to the prompt which disrupts generation.
|
||||||
add_special_tokens = False
|
add_special_tokens = False
|
||||||
|
|
||||||
|
if (self.model_config.encoder_config is not None
|
||||||
|
and self.model_config.encoder_config.get(
|
||||||
|
"do_lower_case", False)):
|
||||||
|
prompt = prompt.lower()
|
||||||
|
|
||||||
return tokenizer.encode(request_id=request_id,
|
return tokenizer.encode(request_id=request_id,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
lora_request=lora_request,
|
lora_request=lora_request,
|
||||||
|
|||||||
@ -26,11 +26,6 @@ def init_tokenizer_from_configs(model_config: ModelConfig,
|
|||||||
trust_remote_code=model_config.trust_remote_code,
|
trust_remote_code=model_config.trust_remote_code,
|
||||||
revision=model_config.tokenizer_revision)
|
revision=model_config.tokenizer_revision)
|
||||||
|
|
||||||
if (model_config.encoder_config is not None
|
|
||||||
and "do_lower_case" in model_config.encoder_config):
|
|
||||||
init_kwargs["do_lower_case"] = model_config.encoder_config[
|
|
||||||
"do_lower_case"]
|
|
||||||
|
|
||||||
return get_tokenizer_group(parallel_config.tokenizer_pool_config,
|
return get_tokenizer_group(parallel_config.tokenizer_pool_config,
|
||||||
**init_kwargs)
|
**init_kwargs)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user