-
-
Notifications
You must be signed in to change notification settings - Fork 12k
[Bugfix] Specify device when loading LoRA and embedding tensors #7129
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] Specify device when loading LoRA and embedding tensors #7129
Conversation
- Add map_location="device" when loading LoRA tensors from .bin files - Add map_location="device" when loading new embeddings from .bin files
|
👋 Hi! Thank you for contributing to the vLLM project. 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:
🚀 |
|
friendly bump! @youkaichao (believe you had reviewed the previous push to fix this) |
vllm/lora/models.py
Outdated
| f" but received {unexpected_modules}." | ||
| f" Please verify that the loaded LoRA module is correct") | ||
| tensors = torch.load(lora_bin_file_path) | ||
| tensors = torch.load(lora_bin_file_path, map_location="device") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you test it? I don't think "device" works. this is a string.
youkaichao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution!
…-project#7129) Co-authored-by: Jacob Schein <[email protected]> Signed-off-by: Alvant <[email protected]>
…-project#7129) Co-authored-by: Jacob Schein <[email protected]> Signed-off-by: LeiWang1999 <[email protected]>
[Bugfix] Assign device when loading LoRA modules from file
Fixes #3374. Note — existing PR to address this issue got stale; so bumping with some light updates.
This PR addresses the issue of CUDA device mismatch when loading LoRA modules from files. It fixes the
Attempting to deserialize object on CUDA device X but torch.cuda.device_count() is Yerror by explicitly specifying the device during tensor loading.Changes:
map_location="device"when loading LoRA tensors from .bin filesmap_location="device"when loading new embeddings from .bin files