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

Getting size mismatch when loading checkpoints saved py the code - tested with PHI-2 #38

Open
sowmaster opened this issue Nov 19, 2024 · 0 comments

Comments

@sowmaster
Copy link

Hi,
Thank you for the great work! I am having issues when i try to load the checkpoints saved during alignment for evaluation.
I loaded the checkpoints with the code (just regular loading which is also used in alpacaEval with HF completions):

model = AutoModelForCausalLM.from_pretrained(path_to_ckpt, cache_dir=cache_dir, **model_kwargs).eval()

The following error show up which says there is mismatch in in param dimensions.

RuntimeError: Error(s) in loading state_dict for PhiForCausalLM:
        size mismatch for model.embed_tokens.weight: copying a param with shape torch.Size([65550080]) from checkpoint, the shape in current model is torch.S
ize([51200, 2560]).
        size mismatch for model.final_layernorm.weight: copying a param with shape torch.Size([0]) from checkpoint, the shape in current model is torch.Size(
[2560]).
        size mismatch for model.final_layernorm.bias: copying a param with shape torch.Size([0]) from checkpoint, the shape in current model is torch.Size([2
560]).
        size mismatch for lm_head.weight: copying a param with shape torch.Size([0]) from checkpoint, the shape in current model is torch.Size([51200, 2560]).

Could be related to how the ckpt are saved. Any ideas of a fix?

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

No branches or pull requests

1 participant