Skip to content

Commit

Permalink
Review suggestion + adds one more test
Browse files Browse the repository at this point in the history
Signed-off-by: Flavia Beo <[email protected]>
  • Loading branch information
flaviabeo committed Oct 24, 2024
1 parent 68ddf14 commit f35329a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ def test_get_pooling_config():
assert minilm_pooling_config.pooling_type == PoolingType.MEAN


def test_get_bert_sentence_transformer_config():
bge_model_config = ModelConfig(
model="BAAI/bge-base-en-v1.5",
tokenizer="BAAI/bge-base-en-v1.5",
tokenizer_mode="auto",
trust_remote_code=False,
seed=0,
dtype="float16",
revision=None,
)

bert_bge_model_config = bge_model_config._get_bert_config()

assert bert_bge_model_config["max_seq_length"] == 512
assert bert_bge_model_config["do_lower_case"]


def test_rope_customization():
TEST_ROPE_SCALING = {"rope_type": "dynamic", "factor": 2.0}
TEST_ROPE_THETA = 16_000_000.0
Expand Down
5 changes: 3 additions & 2 deletions vllm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,9 @@ def _get_and_verify_max_len(
"original_max_position_embeddings"]
derived_max_model_len *= scaling_factor

if bert_config and "max_seq_lenght" in bert_config:
derived_max_model_len = bert_config["max_seq_length"]

# If the user specified a max length, make sure it is smaller than the
# derived length from the HF model config.
if max_model_len is None:
Expand Down Expand Up @@ -1851,8 +1854,6 @@ def _get_and_verify_max_len(
f"{msg} To allow overriding this maximum, set "
"the env var VLLM_ALLOW_LONG_MAX_MODEL_LEN=1")

if bert_config:
max_model_len = bert_config["max_seq_length"]
return int(max_model_len)


Expand Down

0 comments on commit f35329a

Please sign in to comment.