Skip to content

Conversation

@RunningLeon
Copy link
Collaborator

@RunningLeon RunningLeon commented Oct 31, 2025

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

cache routed expert ids and return when finish seq

Use cases

from lmdeploy import pipeline, GenerationConfig, PytorchEngineConfig

if __name__ == '__main__':
    backend_config = PytorchEngineConfig(tp=1, enable_return_routed_experts=True)
    prompts = ['Hello who are you?' * 1024, 'Can you write a poem about AI?']  * 1
    gen_config = GenerationConfig(return_routed_experts=True)
    model_path = 'Qwen/Qwen3-30B-A3B'
    pipe = pipeline(model_path, backend_config=backend_config)
    reps = pipe(prompts, gen_config=gen_config)
    for res in reps:
        print(res)

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant