Skip to content

Commit 931257d

Browse files
committed
[Bugfix] Fix Dense module loading for sentence-transformers embedding models v11
Signed-off-by: FFFfff1FFFfff <[email protected]>
1 parent 8855840 commit 931257d

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

vllm/transformers_utils/config.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,14 @@
3434
KimiVLConfig, MedusaConfig,
3535
MLPSpeculatorConfig,
3636
Nemotron_Nano_VL_Config,
37-
NemotronConfig, OvisConfig,
38-
RWConfig, SpeculatorsConfig,
37+
NemotronConfig,
38+
OvisConfig, RWConfig,
39+
SpeculatorsConfig,
3940
Step3TextConfig, Step3VLConfig,
4041
UltravoxConfig)
4142

42-
try:
43-
from vllm.transformers_utils.configs.mllama import MllamaConfig
44-
except ImportError:
45-
MllamaConfig = None
46-
4743
# yapf: enable
4844
from vllm.transformers_utils.configs.mistral import adapt_config_dict
49-
from vllm.transformers_utils.configs.nvlm_d import NVLM_D_Config
5045
from vllm.transformers_utils.utils import check_gguf_file
5146

5247
if envs.VLLM_USE_MODELSCOPE:
@@ -103,6 +98,20 @@ def _get_hf_token() -> Optional[str]:
10398
"llm_config": "text_config",
10499
}
105100

101+
_AUTO_CONFIG_KWARGS_OVERRIDES: dict[str, dict[str, Any]] = {
102+
"internvl_chat": {
103+
"has_no_defaults_at_init": True
104+
},
105+
# transformers regards mllama as is_encoder_decoder=False
106+
# vllm needs is_encoder_decoder=True to enable cross-attention
107+
"mllama": {
108+
"is_encoder_decoder": True
109+
},
110+
"NVLM_D": {
111+
"has_no_defaults_at_init": True
112+
},
113+
}
114+
106115

107116
class ConfigFormat(str, enum.Enum):
108117
AUTO = "auto"
@@ -924,22 +933,19 @@ def get_hf_file_bytes(file_name: str,
924933
file_path = try_get_local_file(model=model,
925934
file_name=file_name,
926935
revision=revision)
927-
936+
928937
if file_path is None:
929938
try:
930-
hf_hub_file = hf_hub_download(model,
931-
file_name,
932-
revision=revision,
933-
token=_get_hf_token())
939+
hf_hub_file = hf_hub_download(model, file_name, revision=revision, token=_get_hf_token())
934940
file_path = Path(hf_hub_file)
935941
except Exception:
936942
return None
937-
943+
938944
if file_path is not None and file_path.is_file():
939945
try:
940946
with open(file_path, 'rb') as file:
941947
return file.read()
942948
except Exception:
943949
return None
944-
950+
945951
return None

0 commit comments

Comments
 (0)