vllm icon indicating copy to clipboard operation
vllm copied to clipboard

[Core] Add support for loading weight that has already done TP sharding

Open HollowMan6 opened this issue 11 months ago • 5 comments

This PR will be very useful, if we want to sync weights between different vLLM instances with tensor parallel enabled, so that we don't need to all-gather the parameters before-hand, but instead:

  1. Collect the model weight from an available vllm.worker.worker.Worker, via iterating through self.model_runner.model.named_parameters().
  2. Send the weight to the workers that are with the same tp rank as the source, then we can load the weight directly via self.model_runner.model.load_weights().

Tested the PR with llama models with maximum tp size = 4.

HollowMan6 avatar Dec 06 '24 22:12 HollowMan6

👋 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 starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

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

🚀

github-actions[bot] avatar Dec 06 '24 22:12 github-actions[bot]

Thank you for the PR

This PR will be very useful, if we want to sync weights between different vLLM instances with tensor parallel enabled,

Is this used in some post-training framework? or inference workload?

simon-mo avatar Dec 16 '24 00:12 simon-mo

training TP size and inference TP size can (and usually are) different 🤔

youkaichao avatar Dec 16 '24 01:12 youkaichao

Is this used in some post-training framework? or inference workload?

training TP size and inference TP size can (and usually are) different 🤔

It's for the inference and not related to any training weights. As suggested by the PR description, this PR enables the case that, the new vLLM instance model weights are loaded directly from each worker of an old (already-existing) vLLM instance (with tensor parallel enabled).

HollowMan6 avatar Dec 16 '24 08:12 HollowMan6

This pull request has merge conflicts that must be resolved before it can be merged. Please rebase the PR, @HollowMan6.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

mergify[bot] avatar Feb 15 '25 12:02 mergify[bot]