Skip to content

Fix loading pretrained-mm-projector errors under Deepspeed Zero3.#1250

Open
lockon-n wants to merge 1 commit intohaotian-liu:mainfrom
lockon-n:main
Open

Fix loading pretrained-mm-projector errors under Deepspeed Zero3.#1250
lockon-n wants to merge 1 commit intohaotian-liu:mainfrom
lockon-n:main

Conversation

@lockon-n
Copy link

@lockon-n lockon-n commented Mar 8, 2024

In the fine-tuning stage of llava, if we apply deepspeed zero3, it will put placeholders in model parameters instead of initializing real ones.

As a result, the naive load_state_dict raises errors when the code tries to load the pretrained mm projector from somewhere like mm_projector.bin.

This PR solves this by detecting if deepspeed zero3 is applied by the is_deepspeed_zero3_enabled() from transformers, and wraps the loading code with deepspeed.zero.GatheredParameters to make it effective in that case.

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