Skip to content

fix user-specified max_session_len#3785

Merged
lvhan028 merged 2 commits intoInternLM:mainfrom
grimoire:fix-manually-max-session-len
Aug 5, 2025
Merged

fix user-specified max_session_len#3785
lvhan028 merged 2 commits intoInternLM:mainfrom
grimoire:fix-manually-max-session-len

Conversation

@grimoire
Copy link
Copy Markdown
Collaborator

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

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

Modification

Please briefly describe what modification is made in this PR.

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.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

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.

@zhulinJulia24
Copy link
Copy Markdown
Collaborator

LGTM. test case passed!

@lvhan028
Copy link
Copy Markdown
Collaborator

lvhan028 commented Aug 1, 2025

What if num_gpu_blocks=1?

@grimoire
Copy link
Copy Markdown
Collaborator Author

grimoire commented Aug 1, 2025

if int(num_available) // cache_block_size >= 16:
block size would not less than 16

@lvhan028
Copy link
Copy Markdown
Collaborator

lvhan028 commented Aug 4, 2025

from lmdeploy import PytorchEngineConfig, pipeline

engine_config = PytorchEngineConfig(num_gpu_blocks=1)

model_path = 'Qwen/Qwen3-0.6B'
pipe = pipeline(model_path, backend_config=engine_config)

prompt = 'hi'

response = pipe(prompt)

print(response)

The response is:

2025-08-04 10:43:56,473 - lmdeploy - ERROR - async_engine.py:844 - session 0 finished, reason "error"
Response(text='internal error happened', generate_token_len=0, input_token_len=14, finish_reason='error', token_ids=[], logprobs=None, logits=None, last_hidden_state=None, index=0

f' greater than 0, but got {engine_config.max_batch_size}')

num_gpu_blocks = engine_config.num_gpu_blocks
if num_gpu_blocks > 0 and num_gpu_blocks < 16:
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.

This appears to be more of a workaround than a root cause fix. We might need a more permanent solution to address the root cause later.

@lvhan028 lvhan028 changed the title fix manually max_session_len fix user-specified max_session_len Aug 5, 2025
@lvhan028 lvhan028 merged commit 0a2df68 into InternLM:main Aug 5, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants