Conversation
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
No description provided.