Skip to content

[Fix] Allow InternVL to skip dynamic preprocessing - #4828

Open
zcxGGmu wants to merge 1 commit into
InternLM:mainfrom
zcxGGmu:internvl-skip-preprocess
Open

[Fix] Allow InternVL to skip dynamic preprocessing#4828
zcxGGmu wants to merge 1 commit into
InternLM:mainfrom
zcxGGmu:internvl-skip-preprocess

Conversation

@zcxGGmu

@zcxGGmu zcxGGmu commented Aug 5, 2026

Copy link
Copy Markdown

Motivation

Issue #3778 asks how to avoid InternVL's internal dynamic resize/splitting when the application needs a stable mapping back to a prepared image, e.g. grounding coordinates.

Refs #3778

Modification

  • Add skip_preprocess=True support for the legacy InternVL dynamic image preprocessing path.
  • When enabled, LMDeploy skips dynamic_preprocess(...) and applies the existing model transform to the original image as a single patch.
  • Document max_dynamic_patch and skip_preprocess in the English and Chinese InternVL docs.
  • Add a regression test that fails if skip_preprocess=True still calls dynamic_preprocess.

BC-breaking (Optional)

No. The default preprocessing path is unchanged.

Use cases (Optional)

messages = [dict(role='user', content=[
    dict(type='text', text='Describe this image.'),
    dict(type='image_url', image_url=dict(
        url='https://example.com/image.jpg',
        max_dynamic_patch=1,
        skip_preprocess=True))
])]

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
    • PYTHONPATH= python -m pre_commit run --files lmdeploy/vl/model/internvl.py tests/test_lmdeploy/test_vl/test_internvl_preprocess.py docs/en/multi_modal/internvl.md docs/zh_cn/multi_modal/internvl.md
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
    • python -m pytest tests/test_lmdeploy/test_vl/test_internvl_preprocess.py -q
  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.
    • N/A
  4. The documentation has been modified accordingly, like docstring or example tutorials.
    • Updated docs/en/multi_modal/internvl.md and docs/zh_cn/multi_modal/internvl.md.

Signed-off-by: zq <zhouquan1511@163.com>
@lvhan028

lvhan028 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

STOP pull new request until fixing the previous ones.

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.

3 participants