[Bugfix] model_max_length should consider max_model_len in tokenizer_config (#19201)
This commit is contained in:
@@ -23,6 +23,7 @@ from transformers.models.auto.image_processing_auto import (
|
||||
get_image_processor_config)
|
||||
from transformers.models.auto.modeling_auto import (
|
||||
MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
|
||||
from transformers.models.auto.tokenization_auto import get_tokenizer_config
|
||||
from transformers.utils import CONFIG_NAME as HF_CONFIG_NAME
|
||||
|
||||
from vllm import envs
|
||||
@@ -867,3 +868,18 @@ def try_get_safetensors_metadata(
|
||||
"Error retrieving safetensors")
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def try_get_tokenizer_config(
|
||||
pretrained_model_name_or_path: Union[str, os.PathLike],
|
||||
trust_remote_code: bool,
|
||||
revision: Optional[str] = None,
|
||||
) -> Optional[dict[str, Any]]:
|
||||
try:
|
||||
return get_tokenizer_config(
|
||||
pretrained_model_name_or_path,
|
||||
trust_remote_code=trust_remote_code,
|
||||
revision=revision,
|
||||
)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user