Skip to content

[KVConnector]: Add kv_connector_class_name to resolve name conflict with built-in connectors#38314

Closed
maobaolong wants to merge 3 commits intovllm-project:mainfrom
maobaolong:custom_conn_name
Closed

[KVConnector]: Add kv_connector_class_name to resolve name conflict with built-in connectors#38314
maobaolong wants to merge 3 commits intovllm-project:mainfrom
maobaolong:custom_conn_name

Conversation

@maobaolong
Copy link
Copy Markdown
Contributor

@maobaolong maobaolong commented Mar 27, 2026

Purpose

When using an external KV connector via kv_connector_module_path, the kv_connector field is also used as the class name to look up in the loaded module. This causes a conflict if the external class shares the same name as a built-in registered connector (e.g., LMCacheConnectorV1) — the factory matches the registry first and never reaches the dynamic loading path.
This PR adds an optional kv_connector_class_name field to KVTransferConfig. When set, it is used as the actual class name to load from the external module, while kv_connector acts as a logical alias.

{
  "kv_connector": "MyLMCacheConnector",
  "kv_role": "kv_both",
  "kv_connector_module_path": "lmcache.integration.vllm.lmcache_connector_v1",
  "kv_connector_class_name": "LMCacheConnectorV1"
}

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances configuration handling and model support across several components. It introduces kv_connector_class_name for explicit connector class selection and updates the AutoConfig registration logic to handle custom configurations more securely. Several model-specific config classes were refactored to call super().__init__ after attribute assignment to ensure proper initialization. Additionally, DeepSeek-VL2 received compatibility updates for Transformers v5, and a fix was added for Step3.5 to handle inconsistent layer type lengths. I have no feedback to provide.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 27, 2026

Hi @maobaolong, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

1 similar comment
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 27, 2026

Hi @maobaolong, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these changes being made?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, these changes are introduced by accident, revert it.

hmellor and others added 3 commits March 30, 2026 14:37
…ith built-in connectors

Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
@maobaolong
Copy link
Copy Markdown
Contributor Author

@chaunceyjiang Thanks for the remind of the unrelated code changes, revert those code which introduced by accident while rebase code to upstream. PTAL.

@chaunceyjiang
Copy link
Copy Markdown
Collaborator

/cc @NickLucche @ApostaC PTAL.

Copy link
Copy Markdown
Collaborator

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me in general.
@NickLucche Some more context: this PR helps people to do offline debug and pre-prod testing before the changes have been merged into vLLM upstream. Can you take a quick look as well and leave your thoughts?

@orozery
Copy link
Copy Markdown
Collaborator

orozery commented Apr 3, 2026

I think the current "check local registry, fallback to remote import" is confusing.
IMO it should be like this:
if kv_transfer_config.kv_connector_module_path is not None, we should do remote import.
Else, look in the local registry.

Then, we don't need the extra kv_connector_class_name field.
@ApostaC WDYT?

@maobaolong
Copy link
Copy Markdown
Contributor Author

I think the current "check local registry, fallback to remote import" is confusing. IMO it should be like this: if kv_transfer_config.kv_connector_module_path is not None, we should do remote import. Else, look in the local registry.

Then, we don't need the extra kv_connector_class_name field. @ApostaC WDYT?

@orozery Thanks for your review and I also think that PR is better #38301

@maobaolong
Copy link
Copy Markdown
Contributor Author

@ApostaC @orozery @chaunceyjiang #38301 has been merged, thanks for your kindly review and suggestion.

BTW, how to deal this PR? close or merge too?

@chaunceyjiang
Copy link
Copy Markdown
Collaborator

I think we can close it for now. If we have similar needs in the future, we can open it

@maobaolong maobaolong closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek Related to DeepSeek models kv-connector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants