Skip to content

Commit c9989a7

Browse files
committed
fix
1 parent 5d5886e commit c9989a7

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

tests/models/embedding/language/test_snowflake_arctic_embed.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,38 @@
1515
]
1616

1717
MODELS = [
18-
EmbedModelInfo("Snowflake/snowflake-arctic-embed-xs", is_matryoshka=False),
19-
EmbedModelInfo("Snowflake/snowflake-arctic-embed-s", is_matryoshka=False),
20-
EmbedModelInfo("Snowflake/snowflake-arctic-embed-m", is_matryoshka=False),
18+
EmbedModelInfo("Snowflake/snowflake-arctic-embed-xs",
19+
is_matryoshka=False,
20+
architecture="BertModel",
21+
enable_ci_test=True),
22+
EmbedModelInfo("Snowflake/snowflake-arctic-embed-s",
23+
is_matryoshka=False,
24+
architecture="BertModel",
25+
enable_ci_test=False),
26+
EmbedModelInfo("Snowflake/snowflake-arctic-embed-m",
27+
is_matryoshka=False,
28+
architecture="BertModel",
29+
enable_ci_test=False),
2130
EmbedModelInfo("Snowflake/snowflake-arctic-embed-m-long",
22-
is_matryoshka=False),
23-
EmbedModelInfo("Snowflake/snowflake-arctic-embed-l", is_matryoshka=False),
31+
is_matryoshka=False,
32+
architecture="NomicBertModel",
33+
enable_ci_test=True),
34+
EmbedModelInfo("Snowflake/snowflake-arctic-embed-l",
35+
is_matryoshka=False,
36+
architecture="BertModel",
37+
enable_ci_test=False),
2438
EmbedModelInfo("Snowflake/snowflake-arctic-embed-m-v1.5",
25-
is_matryoshka=True),
39+
is_matryoshka=True,
40+
architecture="BertModel",
41+
enable_ci_test=True),
2642
EmbedModelInfo("Snowflake/snowflake-arctic-embed-l-v2.0",
27-
is_matryoshka=True),
43+
is_matryoshka=True,
44+
architecture="XLMRobertaModel",
45+
enable_ci_test=True),
2846
EmbedModelInfo("Snowflake/snowflake-arctic-embed-m-v2.0",
29-
is_matryoshka=True),
47+
is_matryoshka=True,
48+
architecture="GteModel",
49+
enable_ci_test=True),
3050
]
3151

3252

@@ -40,6 +60,10 @@ def test_models(
4060
dtype: str,
4161
monkeypatch,
4262
) -> None:
63+
if not model_info.enable_ci_test:
64+
# A model family has many models with the same architecture,
65+
# and we don't need to test each one.
66+
pytest.skip("Skipping CI test.")
4367

4468
example_prompts = example_prompts + EMBEDDING_PROMPTS
4569

@@ -62,6 +86,10 @@ def test_models(
6286
assert (vllm_model.model.llm_engine.model_config.is_matryoshka ==
6387
model_info.is_matryoshka)
6488

89+
if model_info.architecture:
90+
assert (model_info.architecture
91+
in vllm_model.model.llm_engine.model_config.architectures)
92+
6593
vllm_outputs = vllm_model.encode(example_prompts)
6694

6795
check_embeddings_close(

tests/models/embedding/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ def matryoshka_fy(tensor, dimensions):
4242

4343
class EmbedModelInfo(NamedTuple):
4444
name: str
45-
is_matryoshka: bool
45+
is_matryoshka: bool
46+
architecture: str = ""
47+
enable_ci_test: bool = True

vllm/model_executor/models/bert.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,15 @@ def __init__(self,
414414
rotary_kwargs: Optional[dict] = None,
415415
add_pooling_layer: bool = False):
416416
super().__init__()
417+
"""
418+
For BertModel, all linear layers have bias.
419+
For NomicBertModel, all linear layers do not have bias,
420+
the bias parameter intended to control all linear layers.
421+
For GteModel, only up_gate_proj layer does not have bias,
422+
so the gate_up_proj_bias parameter must be added.
423+
see #16649
424+
"""
425+
417426
config = vllm_config.model_config.hf_config
418427
self.embeddings = embedding_class(config)
419428
self.encoder = BertEncoder(vllm_config=vllm_config,

0 commit comments

Comments
 (0)