Skip to content

simplify interns1 pro codes#4480

Merged
lvhan028 merged 2 commits intoInternLM:mainfrom
CUHKSZzxy:simplify-interns1-pro
Apr 3, 2026
Merged

simplify interns1 pro codes#4480
lvhan028 merged 2 commits intoInternLM:mainfrom
CUHKSZzxy:simplify-interns1-pro

Conversation

@CUHKSZzxy
Copy link
Copy Markdown
Collaborator

Preprocessing code has grown significantly; using inheritance will simplify the interns1 pro file.

Copilot AI review requested due to automatic review settings March 30, 2026 12:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors InternS1 Pro vision model preprocessing by inheriting from the existing Qwen3VL implementation, reducing duplicated preprocessing logic while keeping time-series support.

Changes:

  • Enable trust_remote_code=True when loading the Qwen3 processor.
  • Simplify/centralize InternS1 Pro preprocessing by subclassing Qwen3VLModel and only adding time-series-specific handling.
  • Adjust the FPS fallback warning message used during video preprocessing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lmdeploy/vl/model/qwen3.py Loads the HF processor with trust_remote_code=True and tweaks the FPS fallback warning string.
lmdeploy/vl/model/interns1_pro.py Replaces duplicated Qwen3-like preprocessing with inheritance from Qwen3VLModel, retaining time-series preprocessing/packing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

def build_preprocessor(self):
check_transformers()
self.processor = AutoProcessor.from_pretrained(self.model_path)
self.processor = AutoProcessor.from_pretrained(self.model_path, trust_remote_code=True)
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Enabling trust_remote_code=True allows execution of arbitrary code from the model repository during processor loading. If this is required for Qwen3 processors, consider making it configurable (e.g., via a model/engine option) and/or documenting the security implication so users running untrusted model paths can disable it.

Suggested change
self.processor = AutoProcessor.from_pretrained(self.model_path, trust_remote_code=True)
trust_remote_code = getattr(self, 'trust_remote_code', False)
if trust_remote_code:
logger.warning(
'Enabling trust_remote_code=True when loading the Qwen3VL processor. '
'This allows execution of arbitrary code from the model repository. '
'Disable this option when using untrusted model paths.'
)
self.processor = AutoProcessor.from_pretrained(
self.model_path,
trust_remote_code=trust_remote_code,
)

Copilot uses AI. Check for mistakes.
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.

We will introduce --trust-remote-code next version

metadata = params['video_metadata']
if metadata.get('fps') is None or metadata['fps'] <= 0:
logger.warning('Qwen3VL: fps not found or invalid, fallback to 24.')
logger.warning('fps not found or invalid, fallback to 24.')
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The warning message lost the model identifier; when multiple VLMs are used in the same process, this becomes hard to attribute in logs. Consider including the model name dynamically (e.g., via type(self).__name__) or a consistent prefix.

Copilot uses AI. Check for mistakes.
@lvhan028 lvhan028 self-requested a review April 3, 2026 02:52
@lvhan028 lvhan028 merged commit 8dab8a4 into InternLM:main Apr 3, 2026
9 checks passed
@CUHKSZzxy CUHKSZzxy deleted the simplify-interns1-pro branch April 3, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants