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: ...@@ -107,12 +107,11 @@ class KVConnectorFactory:
if connector_name is None: if connector_name is None:
raise ValueError("Connector name is not set in KVTransferConfig") raise ValueError("Connector name is not set in KVTransferConfig")
compat_sig = False compat_sig = False
if connector_name in cls._registry: connector_module_path = kv_transfer_config.kv_connector_module_path
connector_cls = cls._registry[connector_name]() if connector_module_path is not None and not connector_module_path:
else: raise ValueError("kv_connector_module_path cannot be an empty string.")
connector_module_path = kv_transfer_config.kv_connector_module_path if connector_module_path:
if connector_module_path is None: # External module path takes priority over internal registry.
raise ValueError(f"Unsupported connector type: {connector_name}")
connector_module = importlib.import_module(connector_module_path) connector_module = importlib.import_module(connector_module_path)
try: try:
connector_cls = getattr(connector_module, connector_name) connector_cls = getattr(connector_module, connector_name)
...@@ -128,6 +127,10 @@ class KVConnectorFactory: ...@@ -128,6 +127,10 @@ class KVConnectorFactory:
"Please update to include kv_cache_config as the second argument.", "Please update to include kv_cache_config as the second argument.",
connector_cls.__name__, 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 return connector_cls, compat_sig
@classmethod @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