Unverified Commit 729eb59f authored by maobaolong's avatar maobaolong Committed by GitHub
Browse files

[KVConnector]: prioritize external connector over internal registry (#38301)


Signed-off-by: default avatarbaoloongmao <baoloongmao@tencent.com>
Co-authored-by: default avatarChauncey <chaunceyjiang@gmail.com>
parent 6e110088
......@@ -107,12 +107,11 @@ class KVConnectorFactory:
if connector_name is None:
raise ValueError("Connector name is not set in KVTransferConfig")
compat_sig = False
if connector_name in cls._registry:
connector_cls = cls._registry[connector_name]()
else:
connector_module_path = kv_transfer_config.kv_connector_module_path
if connector_module_path is None:
raise ValueError(f"Unsupported connector type: {connector_name}")
if connector_module_path is not None and not connector_module_path:
raise ValueError("kv_connector_module_path cannot be an empty string.")
if connector_module_path:
# External module path takes priority over internal registry.
connector_module = importlib.import_module(connector_module_path)
try:
connector_cls = getattr(connector_module, connector_name)
......@@ -128,6 +127,10 @@ class KVConnectorFactory:
"Please update to include kv_cache_config as the second argument.",
connector_cls.__name__,
)
elif connector_name in cls._registry:
connector_cls = cls._registry[connector_name]()
else:
raise ValueError(f"Unsupported connector type: {connector_name}")
return connector_cls, compat_sig
@classmethod
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment