Skip to content

[bugfix] Fix internvl#9

Merged
Jintao-Huang merged 6 commits intomodelscope:mainfrom
Jintao-Huang:fix_internvl
Apr 2, 2026
Merged

[bugfix] Fix internvl#9
Jintao-Huang merged 6 commits intomodelscope:mainfrom
Jintao-Huang:fix_internvl

Conversation

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a mechanism to initialize Hugging Face models on the meta device to optimize memory usage, specifically for InternVL models. It adds context managers to GPTBridge for patching weight initialization and device placement. Review feedback identifies a bug where renaming self.processor to self.tokenizer was not updated in all references, and suggests refactoring repetitive import logic for optional model classes to improve maintainability.

@Jintao-Huang
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a mechanism to initialize Hugging Face models on the meta device without weight initialization by adding context managers to GPTBridge and implementing get_hf_meta_model in InternvlBridge. It also refactors InternvlBridge to use AutoTokenizer instead of AutoProcessor. A critical issue was identified where the refactoring from processor to tokenizer is incomplete, as self.processor is still referenced in the get_inputs_embeds method, which will lead to an AttributeError at runtime.

@Jintao-Huang Jintao-Huang merged commit c94a2ad into modelscope:main Apr 2, 2026
1 check passed
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