Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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