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

fail to load checkpoints after zero3 initialize #3574

Closed
Stick-To opened this issue May 19, 2023 · 9 comments
Closed

fail to load checkpoints after zero3 initialize #3574

Stick-To opened this issue May 19, 2023 · 9 comments
Assignees
Labels

Comments

@Stick-To
Copy link

Stick-To commented May 19, 2023

  File "/home/lxr/workspace/t5_train/esm5.py", line 66, in <module>
    engine.load_module_state_dict(torch.load("weight/mt5-small/pytorch_model.bin"))
  File "/home/lxr/workspace/t5_train/deepspeed/runtime/engine.py", line 2421, in load_module_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for MT5ForConditionalGeneration:
        size mismatch for shared.weight: copying a param with shape torch.Size([250112, 512]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.embed_tokens.weight: copying a param with shape torch.Size([250112, 512]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.SelfAttention.q.weight: copying a param with shape torch.Size([384, 512]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.SelfAttention.k.weight: copying a param with shape torch.Size([384, 512]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.SelfAttention.v.weight: copying a param with shape torch.Size([384, 512]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.SelfAttention.o.weight: copying a param with shape torch.Size([512, 384]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight: copying a param with shape torch.Size([32, 6]) from checkpoint, the shape in current model is torch.Size([0]).
        size mismatch for encoder.block.0.layer.0.layer_norm.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([0]).
@dittops
Copy link

dittops commented Jun 1, 2023

@Stick-To I'm also facing this issue. Could you please share how you resolved it?

@tjruwase
Copy link
Contributor

tjruwase commented Jun 1, 2023

@dittops, please re-open and share repro steps including a stack trace. Thanks!

@Alchemy5
Copy link

im also facing this issue, any help would be great!

@iamsile
Copy link

iamsile commented Jun 13, 2023

I'm also facing this issue too, anyone who can help ?

@Alchemy5
Copy link

I actually found a solution to my problem in the Saving and Loading section of this article: https://huggingface.co/docs/accelerate/usage_guides/deepspeed#saving-and-loading

@yix-chen
Copy link

@Stick-To I'm also facing this issue. Could you please share how you resolved it?

@Stick-To
Copy link
Author

I have not solve it

@Zx55
Copy link

Zx55 commented Nov 29, 2023

One possible reason could be the conflict of multiple initialization between hf deepspeed integration and explicit call "deepspeed.zero.Init()". I solve this following here.

@ZeyuLing
Copy link

I met the same problem and solved it by reinitialization. U can deepcopy an original model before u wrap it with deepspeed.initialize. Load your checkpoint to the original model, and run deepspeed.initialize to the loaded one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants