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

[Bugfix] Fix default weight loading for scalars #7534

Merged
merged 4 commits into from
Aug 15, 2024
Merged

Conversation

mgoin
Copy link
Member

@mgoin mgoin commented Aug 14, 2024

It is pretty easy to run into issues when loading scalar weights from checkpoints into parameters, since they can have no shape in some cases, resulting in errors like

  File "/home/mgoin/code/vllm/vllm/model_executor/model_loader/weight_utils.py", line 525, in default_weight_loader
    assert param.size() == loaded_weight.size(), (
AssertionError: Attempted to load weight (torch.Size([1])) into parameter (torch.Size([]))

I think it makes sense to detect and allow "broadcasting" in this special case for ease of use.

@mgoin mgoin requested review from comaniac and youkaichao August 14, 2024 22:57
Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which consists a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of default ones by unblocking the steps in your fast-check build on Buildkite UI.

Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge).

To run full CI, you can do one of these:

  • Comment /ready on the PR
  • Add ready label to the PR
  • Enable auto-merge.

🚀

Copy link
Collaborator

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've been faced to this several times...

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 15, 2024
@mgoin mgoin mentioned this pull request Aug 15, 2024
@simon-mo simon-mo merged commit 21313e0 into main Aug 15, 2024
49 of 51 checks passed
kylesayrs pushed a commit to neuralmagic/vllm that referenced this pull request Aug 17, 2024
zifeitong pushed a commit to zifeitong/vllm that referenced this pull request Aug 20, 2024
fialhocoelho pushed a commit to opendatahub-io/vllm that referenced this pull request Aug 22, 2024
omrishiv pushed a commit to omrishiv/vllm that referenced this pull request Aug 26, 2024
Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
@simon-mo simon-mo deleted the fix-scalar-loading branch October 28, 2024 16:50
KuntaiDu pushed a commit to KuntaiDu/vllm that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants