Skip to content

[Refactor]: Remove tokenizer when building engine#3978

Merged
lvhan028 merged 5 commits intoInternLM:mainfrom
RunningLeon:no-serialize-tokenizer
Sep 17, 2025
Merged

[Refactor]: Remove tokenizer when building engine#3978
lvhan028 merged 5 commits intoInternLM:mainfrom
RunningLeon:no-serialize-tokenizer

Conversation

@RunningLeon
Copy link
Copy Markdown
Collaborator

@RunningLeon RunningLeon commented Sep 16, 2025

Motivation

Remove tokenizer argument in mp engine for bad serialization issue

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.

@grimoire
Copy link
Copy Markdown
Collaborator

@RunningLeon
Copy link
Copy Markdown
Collaborator Author

https://github.com/RunningLeon/lmdeploy/blob/a7b8d2e294aaf6e133e48f5fe9c93d10e509cbc1/lmdeploy/pytorch/engine/mp_engine/zmq_engine.py#L49 Do we need to update in Multiprocessing engine?

Tested ok with zmq engine. So no need to change it.

grimoire
grimoire previously approved these changes Sep 16, 2025
Copy link
Copy Markdown
Collaborator

@grimoire grimoire left a comment

Choose a reason for hiding this comment

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

LGTM

@RunningLeon RunningLeon changed the title [Fix]: do not serialize tokenizer in ray mp engine [Fix]: Remove tokenizer for mp engine Sep 16, 2025
@RunningLeon RunningLeon changed the title [Fix]: Remove tokenizer for mp engine [Refactor]: Remove tokenizer when building engine Sep 16, 2025
@RunningLeon RunningLeon added the enhancement New feature or request label Sep 16, 2025
@lvhan028 lvhan028 requested a review from grimoire September 16, 2025 10:54
@lvhan028 lvhan028 dismissed grimoire’s stale review September 16, 2025 10:54

refactoring again

lvhan028
lvhan028 previously approved these changes Sep 16, 2025
@lvhan028 lvhan028 self-requested a review September 16, 2025 12:06
@lvhan028 lvhan028 dismissed their stale review September 16, 2025 12:06

test failed

self.model_config = model_config
self.cache_config = cache_config
self.tokenizer = tokenizer
self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
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.

Is this true for every model?

Copy link
Copy Markdown
Collaborator

@grimoire grimoire left a comment

Choose a reason for hiding this comment

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

LGTM

@lvhan028 lvhan028 merged commit 8095307 into InternLM:main Sep 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants