[Model] Replace embedding models with pooling adapter (#10769)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -173,8 +173,15 @@ class AutoWeightsLoader:
|
||||
module_load_weights = getattr(module, "load_weights", None)
|
||||
if callable(module_load_weights):
|
||||
loaded_params = module_load_weights(weights)
|
||||
yield from map(lambda x: self._get_qualname(base_prefix, x),
|
||||
loaded_params)
|
||||
if loaded_params is None:
|
||||
logger.warning(
|
||||
"Unable to collect loaded parameters "
|
||||
"for module %s", module)
|
||||
else:
|
||||
yield from map(
|
||||
lambda x: self._get_qualname(base_prefix, x),
|
||||
loaded_params,
|
||||
)
|
||||
|
||||
child_modules = dict(module.named_children())
|
||||
child_params = dict(module.named_parameters(recurse=False))
|
||||
@@ -232,17 +239,24 @@ class AutoWeightsLoader:
|
||||
|
||||
|
||||
def init_vllm_registered_model(
|
||||
hf_config: PretrainedConfig,
|
||||
vllm_config: VllmConfig,
|
||||
*,
|
||||
prefix: str = "",
|
||||
hf_config: Optional[PretrainedConfig] = None,
|
||||
architectures: Optional[list[str]] = None,
|
||||
) -> nn.Module:
|
||||
"""
|
||||
Helper function to initialize an inner model registered to vLLM,
|
||||
based on the arguments passed to the outer vLLM model.
|
||||
"""
|
||||
from vllm.model_executor.model_loader.loader import _initialize_model
|
||||
vllm_config = vllm_config.with_hf_config(hf_config)
|
||||
return _initialize_model(vllm_config, prefix)
|
||||
|
||||
if hf_config is not None:
|
||||
vllm_config = vllm_config.with_hf_config(hf_config)
|
||||
|
||||
return _initialize_model(vllm_config=vllm_config,
|
||||
prefix=prefix,
|
||||
architectures=architectures)
|
||||
|
||||
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user