Skip to content

Commit 2f5095b

Browse files
DarkLight1337JC1DA
authored andcommitted
[Misc] Sort the list of embedding models (vllm-project#10037)
Signed-off-by: DarkLight1337 <[email protected]> Signed-off-by: Loc Huynh <[email protected]>
1 parent 9c207af commit 2f5095b

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

vllm/model_executor/models/registry.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,23 @@
9494
_EMBEDDING_MODELS = {
9595
# [Text-only]
9696
"BertModel": ("bert", "BertEmbeddingModel"),
97+
"DeciLMForCausalLM": ("decilm", "DeciLMForCausalLM"),
9798
"Gemma2Model": ("gemma2", "Gemma2EmbeddingModel"),
9899
"LlamaModel": ("llama", "LlamaEmbeddingModel"),
100+
**{
101+
# Multiple models share the same architecture, so we include them all
102+
k: (mod, arch) for k, (mod, arch) in _TEXT_GENERATION_MODELS.items()
103+
if arch == "LlamaForCausalLM"
104+
},
99105
"MistralModel": ("llama", "LlamaEmbeddingModel"),
100-
"Qwen2ForRewardModel": ("qwen2_rm", "Qwen2ForRewardModel"),
101-
"Qwen2ForSequenceClassification": (
102-
"qwen2_cls", "Qwen2ForSequenceClassification"),
103-
"LlamaForCausalLM": ("llama", "LlamaForCausalLM"),
104106
"Phi3ForCausalLM": ("phi3", "Phi3ForCausalLM"),
105-
"DeciLMForCausalLM": ("decilm", "DeciLMForCausalLM"),
107+
"Qwen2ForRewardModel": ("qwen2_rm", "Qwen2ForRewardModel"),
108+
"Qwen2ForSequenceClassification": ("qwen2_cls", "Qwen2ForSequenceClassification"), # noqa: E501
106109
# [Multimodal]
107110
"LlavaNextForConditionalGeneration": ("llava_next", "LlavaNextForConditionalGeneration"), # noqa: E501
108111
"Phi3VForCausalLM": ("phi3v", "Phi3VForCausalLM"),
109112
}
110113

111-
def add_embedding_models(base_models, embedding_models):
112-
with_pooler_method_models = {}
113-
embedding_models_name = embedding_models.keys()
114-
for name, (path, arch) in base_models.items():
115-
if arch in embedding_models_name:
116-
with_pooler_method_models[name] = (path, arch)
117-
return with_pooler_method_models
118-
119-
_EMBEDDING_MODELS = {
120-
**add_embedding_models(_TEXT_GENERATION_MODELS, _EMBEDDING_MODELS),
121-
**_EMBEDDING_MODELS,
122-
}
123-
124114
_MULTIMODAL_MODELS = {
125115
# [Decoder-only]
126116
"Blip2ForConditionalGeneration": ("blip2", "Blip2ForConditionalGeneration"),

0 commit comments

Comments
 (0)