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

Runtime error on inference.py #76

Open
jmstadt opened this issue Jun 12, 2024 · 1 comment
Open

Runtime error on inference.py #76

jmstadt opened this issue Jun 12, 2024 · 1 comment

Comments

@jmstadt
Copy link

jmstadt commented Jun 12, 2024

Hello, thank you for your excellent work.

I am trying to run inference.py but when I run line 34:

model.load_state_dict(checkpoint["model"], strict=False)

I get a runtime error:

RuntimeError: Error(s) in loading state_dict for Blip2T5:
	size mismatch for t5_model.shared.weight: copying a param with shape torch.Size([64868, 2048]) from checkpoint, the shape in current model is torch.Size([32128, 2048]).
	size mismatch for t5_model.encoder.embed_tokens.weight: copying a param with shape torch.Size([64868, 2048]) from checkpoint, the shape in current model is torch.Size([32128, 2048]).
	size mismatch for t5_model.decoder.embed_tokens.weight: copying a param with shape torch.Size([64868, 2048]) from checkpoint, the shape in current model is torch.Size([32128, 2048]).
	size mismatch for t5_model.lm_head.weight: copying a param with shape torch.Size([64868, 2048]) from checkpoint, the shape in current model is torch.Size([32128, 2048]).

Appreciate any thoughts or guidance. I loaded both the v2 checkpoint and the v2.1 checkpoint with the same result.

@jmstadt
Copy link
Author

jmstadt commented Jun 13, 2024

NVM, per stackoverflow:
model = torch.nn.DataParallel(model)
https://stackoverflow.com/questions/61909973/pytorch-load-incompatiblekeys
Running on CPU, that got me through that line of code.

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